Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Apache Rewrite Problem

i'm moving parts of my site at 〔xahlee.org〕 to 〔wordyenglish.com〕. I have this in 〔.htaccess〕:

…
RewriteRule ^PageTwo_dir/Vocabulary_dir/(.*)$ http://wordyenglish.com/words/$1 [R=301,L]
RewriteRule ^lit/(.*)$ http://wordyenglish.com/lit/$1 [R=301,L]
RewriteRule ^lojban/(.*)$ http://wordyenglish.com/lojban/$1 [R=301,L]
…

everything works, except the dir starting at 〔lit/〕. The error is a redirect to 404 on the original domain.

no other lines contains “lit/”. There's no 〔.htaccess〕 in lit dir.

Turning on rewrite log:

RewriteLog "logs/xx-RewriteLog.log"
RewriteLogLevel 9

doesn't seem allowed or doesn't work with my web hosting environment. When these lines are present, browser returns a server error on any page.

the problem occurs only with that one particular dir. Seems there's some magic with “lit/”. Any suggestion?

share|improve this question

2 Answers 2

the problem went away with this:

• create a dir “lit”, create a file under it. • access the file thru browser. • delete the file and dir. • now, the redirect suddenly works.

maybe some glitch on cache somewhere. Not sure exactly what's the cause. Other dirs that are removed didn't have this problem. Just this dir.

share|improve this answer

Try replacing the second line with:

RewriteCond %{HTTP_HOST} .*
RewriteRule ^lit/(.*)$ http://wordyenglish.com/lit/$1 [R=301,L]

Also the rewrite log rules must go in httpd.conf or your vhost configuration, not in .htaccess.

share|improve this answer
    
thanks for the tip on the rewrite log line. Though, still didn't work. Same behavior as before. –  Xah Lee Jul 17 '12 at 4:00
1  
OK but now you have logs :) Keep them at level 3 or 4 - should be more than sufficient. Paste the log and comment here if you can't figure it out. –  Ansari Jul 17 '12 at 4:01

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.