I want to create a permanent rewrite rule that will tell visitors and SEs to use the new static pages instead of the previous dynamic pages; an external rule.
For example, a previous page might have been
- Code: Select all
http://mysite.com/index.php?page=pagename
which I want to be rewritten to
- Code: Select all
http://mysite.com/pagename.php
This seems fairly easy but when I try to do so in my .htaccess file in the site root it doesn't do anything. Here are a few different versions that I have tried, note that I only use ONE of these at a time but none seem to work.
- Code: Select all
rewrite rule ^([^/]+)/index\.php\?page=(.+)$ $1/$2.php [R=301,L]
RewriteRule ^index\.php\?page=(.*)$ $1.php [R=301,L]
The first generates a server error, the second just doesn't change anything.
It seems this should be easy but... NOT. I am running a WAMP installation with Apache2. Any ideas from you experts out there?