Scenario
I'm trying to use a very simple <Directory>
instruction in my .htaccess
file and it's resulting in an apache error.
Question
How can I specify RewriteRules for different directories without having to use .htaccess
files inside those sub directories?
.htaccess
<Directory "/var/www/my/build/folder">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /([^/]+)/?$ [NC]
RewriteRule .* my/build/folder/index.html [L]
</Directory>
Apache Error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.7 (Ubuntu) Server at dev.mediajackagency.com Port 80
The
Directory
directive doesn't work on.htaccess
context, but on server config or virtual host context. Either you place the configuration on server/vhost configuration or place an.htaccess
file in that exact directory.