Need very simple help with .htacces (beginner)

  • breadfan
  • Born
  • Born
  • No Avatar
  • Joined: Jun 23, 2008
  • Posts: 2
  • Status: Offline

Post June 23rd, 2008, 5:39 am

Hi.

What should my .htaccess file look like if I want to redirect http://www.mysite.com/index.php?page=photos to http://www.mysite.com/photos/?

I went through some tutorials but couldn't work it out. Please help.

Thank you in advance.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 23rd, 2008, 5:39 am

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6130
  • Loc: Seattle, WA
  • Status: Offline

Post June 23rd, 2008, 6:58 am

Code: [ Select ]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/(.+?)/?$ /index.php?page=$1 [L]
</IfModule>
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine on
  3. RewriteRule ^/(.+?)/?$ /index.php?page=$1 [L]
  4. </IfModule>

This would rewrite mysite.com/anything/ to mysite.com/index.php?page=anything

http://www.google.com/search?q=mod_rewrite+tutorial
The Beer Monocle. Classy.
  • breadfan
  • Born
  • Born
  • No Avatar
  • Joined: Jun 23, 2008
  • Posts: 2
  • Status: Offline

Post June 23rd, 2008, 8:37 am

Thank you very much :) However I now have to face another similar problem. Sometimes there are two parameters in the url, like http://www.mysite.com/index.php?page=gallery&photo=2 for example. What should the .htaccess look like now in order for it to work? I guess it is important to say that there is sometime only the page parameter and sometime also the photo parameter.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 56 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.