Symfony2和子域

时间:2014-12-22 08:45:39

标签: apache symfony mod-rewrite subdomain virtualhost

在我的计算机上,我有一个Symfony2项目,路径就是这样: localhost / project / web / app.php / wiki / XXXXX

我有一个域名和子域名,并且在我的服务器上,我希望路线看起来像: wiki.domain.com/XXXXX

实际上,当我去 wiki.domain.com 时,我在app.php页面,因为我将子域重定向到project / web / app.php,这要归功于这个vhost: / p>

<VirtualHost *:80>
        ServerName wiki.domain.com
        DocumentRoot /var/www/project/web/
        <Directory /var/www/project/web>
                DirectoryIndex app.php
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]
    # Rewrite all other queries to the front controller.
    RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>
</VirtualHost>

但如果我想去XXXXX路线,我总是要去 wiki.domain.com/app.php/wiki/XXXXX

你知道如何解决这个问题吗?

0 个答案:

没有答案