From: Rich Bowen Canonical URLs
Virtual Hosts Per User
Moved
DocumentRoot
Fallback Resource
Mass Virtual Hosting
Proxying Content with mod_rewrite
See also
@@ -589,6 +590,55 @@ rather than rewriting URLs.
As of version 2.4, you should use the FallbackResource
directive for this:
+<Directory /var/www/my_blog> + FallbackResource index.php +</Directory> +
However, in earlier versions of Apache, or if your needs are more +complicated than this, you can use a variation of the following rewrite +set to accomplish the same thing:
+ ++<Directory /var/www/my_blog> + RewriteBase /my_blog + + RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-f + RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-d + RewriteRule ^ index.php [PT] +</Directory> +
If, on the other hand, you wish to pass the requested URI as a query +string argument to index.php, you can replace that RewriteRule with:
+ ++ RewriteRule (.*) index.php?$1 [PT,QSA] +
Note that these rulesets can be uses in a .htaccess
+file, as well as in a <Directory> block.
As of version 2.4, you should use the
+<Directory /var/www/my_blog> + FallbackResource index.php +</Directory> ++
However, in earlier versions of Apache, or if your needs are more +complicated than this, you can use a variation of the following rewrite +set to accomplish the same thing:
+ ++<Directory /var/www/my_blog> + RewriteBase /my_blog + + RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-f + RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-d + RewriteRule ^ index.php [PT] +</Directory> ++
If, on the other hand, you wish to pass the requested URI as a query +string argument to index.php, you can replace that RewriteRule with:
+ ++ RewriteRule (.*) index.php?$1 [PT,QSA] ++
Note that these rulesets can be uses in a .htaccess
+file, as well as in a <Directory> block.