Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

The .htaccess we have in our document_root directory is as follows:

RewriteEngine on

RewriteRule ^posts/1/first-post-title$ /posts/1.html [L]
RewriteCond %{REQUEST_URI} ^/posts/1
RewriteCond %{REQUEST_URI} !/^posts/1/first-post-title$
RewriteRule (.*) posts/1/first-post-title [R=301,L]

With just the first RewriteRule line, the server correctly redirects. When the other three lines are included and we navigate to "http://localhost/posts/1/first-post-title", Safari is giving an error of:

Too many redirects occurred trying to open “http://localhost/posts/1/first-post-title”. This might occur if you open a page that is redirected to open another page which then is redirected to open the original page.

share|improve this question

migrated from serverfault.com May 7 '11 at 11:59

This question came from our site for system and network administrators.

1 Answer 1

Your second line (first RewriteCond rule) is causing a perpetual match. The URL you redirect people to is matching and being redirected again. Drop that rule entirely and you should be good to go.

share|improve this answer

Your Answer


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