简体   繁体   English

.htaccess重写无法与虚拟主机中的Alias协同工作

[英].htaccess rewrite not working in tandem with Alias from virtual host

I have the following file setup 我有以下文件设置

/var/www
  |-app1
      - index.php
      - .htaccess
  |-app2
      - index.php
      - .htaccess

In virtual hosts I have an alias setup because I want to serve different apps according to url: 在虚拟主机中,我有一个别名设置,因为我想根据URL提供不同的应用程序:

Alias /application1 /var/www/app1
Alias /application2 /var/www/app2

All works well: if I access /aplication1 but if I access /application1/something/ I get 404 but this shouldn't happen because of .htaccess from each app folder: 一切正常:如果我访问/aplication1但访问/application1/something/我得到404,但是由于每个应用程序文件夹中的.htaccess都不会发生这种情况:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php/$0 [PT,NC,L]
</IfModule>

Any idea what I'm doing wrong? 知道我在做什么错吗?

Solution is to add alias to RewriteBase in .htaccess . 解决方案是在.htaccess为RewriteBase添加别名。 Ex: 例如:

RewriteBase /application1/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM