Avatar of Steven Debock
Steven Debock
 asked on

redirect url .htaccess

Hello experts

Quick question.

I'm using piwigo as a photo gallery site.
I want the frontpage to open a photo album and not the category view of albums.
I didn't find any piwigo way of doing it (or i must have overlooked it) so i'm looking to try it with .htaccess

I want my current URL :
http://www.mysite.com/gallery/
To default to:
http://www.mysite.com/gallery/index.php?/category/2

I tried

RewriteEngine on
RewriteRule ^ index.php?/category/2 [R,L]

this puts the homefolder path in the url to making it break
it becomes http://www.mysite.com/home/domains/mysite.com/gallery/index.php?/category/2

Can anyone give me a quick shout on what the correct rewriterule is for what i'm trying to achieve ?

Greetz
Apache Web ServerWeb Development

Avatar of undefined
Last Comment
Steven Debock

8/22/2022 - Mon
Dontmilkthis

Since it appears you want to redirect it to the same location every time, can you not just put the full URL in the redirect?

RewriteEngine on
RewriteRule ^ http://www.mysite.com/gallery/index.php?/category/2 [R,L]
Steven Debock

ASKER
Hello

When i try that it creates a loop
The_page_is_not_redirecting_properly
ASKER CERTIFIED SOLUTION
Dontmilkthis

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
junipllc

You can also try (syntax not double-checked):

Redirect permanent /gallery/ /gallery/index.php?/category/2

Look up the Redirect syntax, though...I'm not sure if you need the leading slashes. Not even sure it will work, but I just wanted to throw this possibility out there in case you don't want to use mod_rewrite (even though you mentioned it in your question).

Cheers,

Mike
Your help has saved me hundreds of hours of internet surfing.
fblack61
Steven Debock

ASKER
thnx,
adding RewriteCond %{REQUEST_URI} ^/gallery/$
did the trick