Need very simple help with .htacces (beginner)

  • breadfan
  • Born
  • Born
  • breadfan
  • Posts: 2

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

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
  • breadfan
  • Born
  • Born
  • breadfan
  • Posts: 2

Post 3+ Months Ago

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 78 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
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.