Commit c3e702d4 authored by Adrian Rossouw's avatar Adrian Rossouw

Simplify the inclusion of .htaccess, and move the files dir redirect to after the includes.

parent 2990f97a
......@@ -2,5 +2,21 @@
Order allow,deny
Allow from all
<?php print $extra_config; ?>
<?php
if (file_exists("{$this->root}/.htaccess")) {
print "\n# Include the platform's htaccess file\n";
print "Include {$this->root}/.htaccess\n";
}
?>
# Do not read the platform's .htaccess
AllowOverride none
<IfModule mod_rewrite.c>
RewriteEngine on
# allow files to be accessed without /sites/fqdn/
RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]
</IfModule>
</Directory>
......@@ -90,33 +90,3 @@ function drush_provision_drupal_post_provision_verify() {
}
}
/**
* Inject the relevant .htacces configuration into the global apache
* configuration
*
* This basically loads the regular .htacess but adds an AllowOverride
* none so the .htaccess are ignored, as a performance improvement.
*
* @see platform/provision_drupal_htaccess.tpl.php
* @see hook_provision_apache_dir_config()
*/
function provision_drupal_provision_apache_dir_config($data = null) {
$htaccess = <<<EOF
<IfModule mod_rewrite.c>
RewriteEngine on
# allow files to be accessed without /sites/fqdn/
RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]
</IfModule>
EOF;
$htaccess .= file_get_contents(d()->root . '/.htaccess');
$htaccess .= <<<EOF
# Do not read the platform's .htaccess
AllowOverride none
EOF;
# the trailing newline above is necessary
return $htaccess;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment