Forum Moderators: phranque
I am trying to setup a 301 redirect on one of my doamins so it poisnts to my main site. However when using mod rewrite I get a 403 Forbidden error.
This is in my .htaccess:
RewriteEngine On
Options +FollowSymlinks
RewriteRule ^/(.*) [mydomain.com...] [R=301,L]
This is my error log:
[Mon Feb 2 05:50:45 2004] [error] [client 131.111.195.211] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/virtual/site27/fst/var/www/html
The implication of the cited thread is that you cannot use a mod_rewrite directive before you enable mod_rewrite using Options +FollowSymLinks.
Therefore, you must reverse the order of your first two directives.
In addition, you will need to exclude the "correct" domain from being rewritten -- Otherwise, you'll get an infinite rewrite loop.
The "classic" code for doing this is:
RewriteCond %{HTTP_HOST} !^www\.correctdomain\.com
RewriteRule (.*) http://www.correctdomain.com/$1 [R=301,L]
You will need your first two lines with this code, too.
Ref: Introduction to mod_rewrite [webmasterworld.com]
Jim