Solved

redirect url .htaccess

Posted on 2013-11-13
5
648 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

777 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