开发者

How to use Alias as well as Redirect together on same url

I have two projects on same IP. I want /www/site/fortis/ served by /projects/fortis and /www/site/myfood/ served by /projects/myfood, but I am not using DocumentRoot. My code is:

Alias /myfood /opt/bitnami/projects/myfood/
<Directory  /opt/bitnami/projects/myfood/>
Order allow,deny
Allow from all
</Directory>


Alias /fortis /opt/bitnami/projects/fortis_django/
<Directory  /opt/bitnami/projects/fortis_django/>
Order allow,de开发者_开发问答ny
Allow from all
</Directory>
Redirect /fortis/login/

RedirectMatch /fortis  /fortis/login/
RedirectMatch /myfood  /myfood/index/

How can I achieve both together?


For the more complex tasks like this, I always find myself falling back to mod_rewrite. I don't have a setup at hand where I can pull together a config for you, but it would be something along the lines of:

RewriteEngine On

RewriteRule   ^/projects/fortis/(.*)  /www/site/fortis/$1  [NC,R,N]
RewriteRule   ^/projects/myfood/(.*)  /www/site/myfood/$1  [NC,R]

I'm sure you'll need to tweak that to match, but mod_rewrite gives you much more control -- hopefully it's enough.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜