I have a strange Apache/WordPress redirect loop that I can't seem to figure out.

Here is the relevant logs and other info: http://pastebin.com/E1afW2vw

It seems that the page request gets made, and it tries to redirect to the proper directory based on the Alias given in the httpd.conf file. But when it tries to replace back the given URL, it fails to recognize that the directory is an alias and doubles up the base directory (/blog/blog/).

Any ideas what might be causing this? And how to fix it?

Also... the .htaccess file is located in the root of the /wp directory that is aliased to /blog

  • You have already asked this question before, right? .. or maybe it is my imagination .. as I have definitely seen something like that already.
    – LazyOne
    Commented Sep 8, 2011 at 21:48
  • Yes, but in a different section of StackExchange. I voted to delete the other one since this seems to be a better place for it.
    – Benjam
    Commented Sep 9, 2011 at 1:08

1 Answer 1


It looks to me like you final rewrite rule

RewriteRule . /blog/index.php [L]

should be

RewriteRule . index.php [L]

Since you're already in the /blog/ directory there's no need to add that to the path.

Your first request is not matching any rewrite rules and is falling through to the default DirectoryIndex.

In the second request you are matching 2011/06/suits/ which gets rewritten to /blog/index.php but since you're already in the blog directory it adds the extra /blog and then re-runs through the rules. It re-strips-out the first /blog but then because your first rule doesn't match, it matches on the last rule repeating the process.

  • This works, but the only issue is that the rewrite rules were created by WordPress, and I'm worried that the client will click the "Update Permalinks" button, reverting to the original rewrite rules, and break the site. Is there any other way around this issue besides editing the rewrite rules?
    – Benjam
    Commented Sep 9, 2011 at 1:13
  • 1
    I haven't work with Wordpress enough to say how it handles the generation or why it generated what it did. My guess is that it has to do with the alias and what you told Wordpress it's path was. One option though is to change the permissions on the .htaccess file so that Wordpress wouldn't be allowed to change it automatically.
    – matthew
    Commented Sep 9, 2011 at 1:40
  • Thanks, I'll try the permissions route if it becomes a problem.
    – Benjam
    Commented Sep 12, 2011 at 1:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.