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

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

share|improve this question
    
You have already asked this question before, right? .. or maybe it is my imagination .. as I have definitely seen something like that already. –  LazyOne Sep 8 '11 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 Sep 9 '11 at 1:08
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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 Sep 9 '11 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 Sep 9 '11 at 1:40
    
Thanks, I'll try the permissions route if it becomes a problem. –  Benjam Sep 12 '11 at 1:14
add comment

Your Answer

 
discard

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

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