Using mod_rewrite with VirtualDocumentRoot
January 21, 2009 – 8:33 pmIn our dev environment, we use VirtualDocumentRoot to avoid configuring new environments when we get a new developer. It’s awesome.
However, if you try to use mod_rewrite, you’ll find that your rewrite rules will prepend whatever you have defined as the document root in the config file. To get around this, you have to use the PT (passthrough) flag, which will solve the issue.
Example:
RewriteRule ^/photo/(.*) /open.php?id=$1 [L,NE,PT]
Found here, on an apache archive.



One Response to “Using mod_rewrite with VirtualDocumentRoot”
RewriteBase /
Seems to do the trick for me too. I’ve not tested it thoroughly though.
By Lewis on Jul 22, 2010