Created
August 15, 2013 17:55
-
-
Save rbayliss/6243023 to your computer and use it in GitHub Desktop.
Drupal .htaccess rewrite rules that can be used both with and without a VirtualDocumentRoot. Shamelessly stolen from Symfony2 Standard Edition (https://github.com/symfony/symfony-standard/blob/master/web/.htaccess)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
# Determine the RewriteBase automatically and set it as environment variable. | |
# If you are using Apache aliases to do mass virtual hosting or installed the | |
# project in a subdirectory, the base path will be prepended to allow proper | |
# resolution of the app.php file and to redirect to the correct URI. It will | |
# work in environments without path prefix as well, providing a safe, one-size | |
# fits all solution. But as you do not need it in this case, you can comment | |
# the following 2 lines to eliminate the overhead. | |
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ | |
RewriteRule ^(.*) - [E=BASE:%1] | |
# Rewrite all queries not matching a file or directory to index.php | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !=/favicon.ico | |
RewriteRule ^(.*)$ %{ENV:BASE}/index.php?q=$1 [L,QSA] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment