Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having an issue implementing 301 Redirects via .htaccess file on an Apache server.

I can enable the 'Redirect 301' statements in the .htaccess file and they will appear to work for a few minutes, but soon after the server starts returning "too many automatic redirects" errors and the site becomes unavailable.

Clearly, I have a loop somewhere in the code, but I can't see it. Would someone be able to point it out?

Also, should I be using 'RedirectMatch' instead of 'Redirect'?

Here is the content of the .htaccess file:

ErrorDocument 404
RewriteEngine On
RewriteRule (wooden_house|straw_house|brick_house_(One|Two|Three)Piggy)\.html$ /$1.php  

# //Rewrite to www
Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^ [nc]
RewriteRule ^(.*)$$1 [r=301,nc]

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]

# //301 Redirect Old File
Redirect 301 /index.php
Redirect 301 /index.shtml
Redirect 301 /
Redirect 301 /default.htm
share|improve this question
What URL are you being sent to by the infinite redirects? – Shane Madden Jul 19 '12 at 3:05
No URL... the browser either displays a blank screen or a message from the browser stating that the requested page cannot be displayed because of too many redirects. I'm wondering if there's a setting on the server that is causing the redirect issue because I just don't see where it's happening in the code I have in the .htaccess file. – n00b-user Jul 23 '12 at 13:48
Some browsers will tell you, some will not, but there is a Location header being sent in responses to your browser. It would be helpful to have that information - can you gather it either using curl -v or a packet capture tool like wireshark? Additionally, what kind of content are you serving - just PHP code? What's an example URL that you're attempting to load when the problem occurs? – Shane Madden Jul 23 '12 at 15:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.