Rewrite an Alias directory

TJHeuvel picture TJHeuvel · Aug 28, 2012 · Viewed 17k times · Source

I'm trying to first use an Alias folder to store my project files in a different location than my DocumentRoot, and then execute a mod_rewrite on this request. However it doesn't seem to parse the .htaccess file.

This is the content of my Alias file:

Alias /test F:/Path/To/Project

<Directory F:/Path/To/Project>
    Order allow,deny
    Allow from all
</Directory>

This is my .htaccess file:

Options +FollowSymlinks
RewriteEngine on

RewriteRule .* index.php [NC] [PT]

When I remove the Alias everything works fine.

Answer

jornak picture jornak · Aug 28, 2012

mod_alias ALWAYS takes precedence over mod_rewrite. You can never override a mod_alias directive with mod_rewrite.

The AliasMatch directive may help you in this case.