Solved

redirect url .htaccess

Posted on 2013-11-13
5
638 Views
Last Modified: 2013-11-14
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
0
Comment
Question by:Th0R
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Dontmilkthis
ID: 39646610
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]
0
 

Author Comment

by:Th0R
ID: 39646620
Hello

When i try that it creates a loop
The_page_is_not_redirecting_properly
0
 
LVL 5

Accepted Solution

by:
Dontmilkthis earned 500 total points
ID: 39646638
I'm guessing you'll need to put a RewriteCond on it then

if you check out this link there's a couple of basic examples - http://webmaster.iu.edu/tools-and-guides/maintenance/redirect-htaccess.phtml

you'll have to adjust this as required, but my first stab would be something like

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/gallery/$
RewriteRule ^ http://www.mysite.com/gallery/index.php?/category/2 [R,L]
0
 
LVL 12

Expert Comment

by:junipllc
ID: 39647761
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
0
 

Author Closing Comment

by:Th0R
ID: 39649068
thnx,
adding RewriteCond %{REQUEST_URI} ^/gallery/$
did the trick
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now