How can I get mod_rewrite and mod_alias to work together?
I have a Windows/Apache/PHP environment set up to imitate a shared hosting account but cannot get mod_alias
and mod_rewrite
to play nicely with one another. Both are definitely enabled at the server level and on a per-site basis.
I have d:\web\public_html\
set up as DocumentRoot. But generally speaking it will be empty.
I have d:\web\sites\
which is where I'll be storing my sites and pointing to using Alias
and it has the following directory structure beneath it:
d:\web\sites\alfa d:\web\sites\alfa\public_html d:\web\sites\bravo d:\web\sites\bravo\public_html
I have aliases set up as follows: (and they definitely work!)
Alias /alfa d:/web/sites/alfa/public_html<Directory "D:\web\sites\alfa\public_html">
Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all</Directory>
The public_html
folder(s) are where my per-site .htaccess
files are stored and they definitely have mod_rewrite
enabled but won't work correctly.
So far I have come unstuck with what RewriteBase
should开发者_开发知识库 be. I've tried /
, /alfa
, /alfa/
and alfa/
. I've even tried d:\web\sites\alfa\public_html
, d:/web/sites/alfa/public_html
, d:\web\sites\alfa
and d:/web/sites/alfa
to no avail!
Is this even possible? If so, what am I doing wrong?
I'd obviously like to keep my Alias
directives centralised and by RewriteRule
s in per-site .htaccess
files.
You are using the
AllowOverride None
directive and thus disabling any .htaccess
files in the aliased directory.
Remove that, and it should work.
/
should work for RewriteBase
.
精彩评论