With mod_rewrite can I specify a RewriteBase within a RewriteCond?

The only solution we finally found looks like that : # Activation of the URL Rewriting Options +FollowSymlinks RewriteEngine On # RewriteBase equivalent – Production RewriteCond %{HTTP_HOST} !^localhost$ RewriteRule . – [E=REWRITEBASE:/production/path/] # RewriteBase equivalent – Development RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule . – [E=REWRITEBASE:/development/path/] # Rewriting RewriteRule ^(.*)$ %{ENV:REWRITEBASE}index.php?page=$1 [L] This code offers a way … Read more

mod_rewrite: what does this RewriteRule do?

The RewriteCond directive just describes an additional condition for a RewriteRule directive. So RewriteCond must always be associated with a RewriteRule. In your case the three RewriteCond probably belong to the first RewriteRule like this: RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ – [NC,L] Now this rule is applied … Read more

How do you enable mod_rewrite on any OS?

Nope, mod_rewrite is an Apache module and has nothing to do with PHP. To activate the module, the following line in httpd.conf needs to be active: LoadModule rewrite_module modules/mod_rewrite.so to see whether it is already active, try putting a .htaccess file into a web directory containing the line RewriteEngine on if this works without throwing … Read more