I am getting a "too many redirects" error from the following two .htaccess files.
.htaccess on domain 1
Redirect 301 / http://www.domain2.com/
.htaccess on domain 2
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /forum/ [L,R]
RedirectMatch permanent ^/$ /forum/
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} badsite1\.com [NC,OR]
RewriteCond %{HTTP_REFERER} badsite2\.com [NC]
RewriteRule .* - [F]
Anyone know the reason for the too many redirects error?
Best Answer
Does the directory "/forum/" exist on your site in domain2? If not, then following
RewriteCond
(Rewrite conditions) &RewriteRule
will always result in redirecting to/forum/
That would result in an infinite redirect loop resulting in a
too many redirects
error.From your additional comments you say that the following three lines of code cause the redirect loop:
By any chance is "badsite1.com" or "badsite2.com" also a part of your domain name? For example if the literal "badsite1.com" is "fred.com" and your domain is "myfred.com" then this condition will match your site's requests.