I'm moving code from a server that served a single domain to one that serves multiple domains. I'm using named virtual hosts to handle the different domains. The url rewriting is not being executed

  • I know that virtual hosts work on that server because the other domains work
  • I know that this particular domain is working because when I hit pingtest.iguiders.com I see the index.html file I left in www/ping/. ('ping' is the dir that pingtest points to because, after my test works, the real domain, ping.iguiders.com will point here)
  • I know that htaccess is generally working on this server because my other domains use it extensively.
  • I initially copied pingtest.iguiders.com in /sites-available from another virtual host that uses htaccess and works. I just changed the server alias and the document root
  • the virtual host definition does contain RewriteEngine On

Here is the entire .htaccess file

RewriteEngine on

RewriteLog "/var/log/rewrite.log"
RewriteLogLevel 7

# Pings for ping server
RewriteRule ^0.02/ping/$ ping_functional.php [L,qsa]
RewriteRule ^0.03/ping/$ ping_functional.php [L,qsa]
RewriteRule ^0.04/ping/$ ping_functional.php [L,qsa]
RewriteRule ^0.05/ping/$ index.html [L,qsa]

But when I try pingtest.iguiders.com/0.05/ping/ I do not get the index.html file I expect (Nor do 0.02, 0.03, etc. work). I get a 404. I suspect that the .htaccess is not being accessed at all because I never see the rewrite log I defined.

Anything obvious I screwed up?

| improve this question | | | | |
  • Is your apache caching the .htaccess? Is it possible to reload/start? – ott-- Dec 5 '12 at 22:12
  • You have generated a rewrite log file .... what does it indicate? – mdpc Dec 5 '12 at 22:16
  • @ott-- No such thing in Apache. One of the reasons for why enabling .htaccess (AllowOverride) is making it a lot slower. For each request it will recursively go through all directories for those files. – gertvdijk Dec 5 '12 at 22:53
  • Actually, that's one of the hints that make me think the .htaccess file is not even being seen. There is no log file generated. – dl__ Dec 5 '12 at 22:59

Are you by any chance missing a / in your RewriteRule ^0.02/ping/$, between ^ and 0.02/ping/? What would happen if you remove ^ or replace it with a ^/?

| improve this answer | | | | |
  • Well, I tried both of your suggestions but they had no effect. Removing the ^ shouldn't work because then rule would trigger only if the url started with those characters but the urls are pingtest.iguiders.com/0.02/ping/?parameters.... – dl__ Dec 5 '12 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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