I have the following .htaccess file:
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*)$ ./page.php?name=$1
I also have about 20 different static addressess I want to do a 301 redirect to.
It should look something like:
Redirect 301 http://www.example.com/category.php?id=3 http://www.example.com/books
Redirect 301 http://www.example.com/articles.php?id=124 http://www.example.com/birds
I tried every method and failed.
Can somebody help me?
I’m guessing your after a set of SEO friendly URL’s for those in your redirect examples, if this is the case then you don’t want a browser redirect, instead you want an Internal Redirect or Alias e.g.
If you have many rules and have access to the httpd.conf you may want to consider a rewrite map file and rule.
Per your comment BELOW, if you want to force users/crawlers to the new URL structure then you’ll need an additional set of Rewrite rules in the file (not redirects) e.g.
FYI: The Apache mod_rewrite documentation is worth a read if your unclear as to what the above rules do, or if you want something a little more abstract consider the following post.