2017-09-05 24 views
0

私はこのように私の仮想ホスト(apache2の)構成されていますsymfonyの生産ルーティングの問題

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName mysite.com 
    ServerAlias www.mysite.com 
    DocumentRoot /var/www/mysite.com/public_html/web 
    <Directory /var/www/mysite.com/public_html/web> 
     Require all granted 
     AllowOverride All 
     Order Allow,Deny 
     Allow from All 
    </Directory> 
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

を、私は、ホームページや資産ではなく、他のルートを見ることができます。

私はドキュメントルートを変更した場合:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName mysite.com 
    ServerAlias www.mysite.com 
    DocumentRoot /var/www/mysite.com/public_html/web/app.php 
    <Directory /var/www/mysite.com/public_html/web/app.php> 
     Require all granted 
     AllowOverride All 
     Order Allow,Deny 
     Allow from All 
    </Directory> 
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

今私は資産...

どのように私は、セットアップのすべてのルートと資産を参照するには、仮想ホストをすることができますすべてのルートを見ることはできませんが?

+0

このgonfigはWindows上にありますか? –

+0

はUbuntuにあります16.04 –

+0

最初の設定を使って他のルートにアクセスしようとするとどうなりますか? –

答えて

1
<VirtualHost *:80> 
    ServerName test.io 
    DocumentRoot "your_project_path/web" 
    RewriteRule ^/?(.*) http://test.io/app.php$1 [R,L] 
    <Directory "your_project_path/web"> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride All 
     Order Allow,Deny 
     Allow from all 
     Require all granted 
     RewriteEngine On 
     RewriteCond %{REQUEST_FILENAME} -s [OR] 
     RewriteCond %{REQUEST_FILENAME} -l [OR] 
     RewriteCond %{REQUEST_FILENAME} -d 
     RewriteRule ^.*$ - [NC,L] 
     RewriteRule ^(.*) /app.php [NC,L] 
    </Directory> 
</VirtualHost> 

もチェックウェブ/ .htaccessの

DirectoryIndex app.php 
    <IfModule mod_negotiation.c> 
      Options -MultiViews 
    </IfModule> 

    <IfModule mod_rewrite.c> 
     RewriteEngine On 
     RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ 
     RewriteRule ^(.*) - [E=BASE:%1] 

     # Sets the HTTP_AUTHORIZATION header removed by apache 
     RewriteCond %{HTTP:Authorization} . 
     RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
     RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
     RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] 
     RewriteCond %{REQUEST_FILENAME} -f 
     RewriteRule .? - [L] 
     RewriteRule .? %{ENV:BASE}/app_dev.php [L] 
    </IfModule> 

    <IfModule !mod_rewrite.c> 
     <IfModule mod_alias.c> 
       RedirectMatch 302 ^/$ /app.php/ 
       # RedirectTemp cannot be used instead 
     </IfModule> 
    </IfModule> 

アスパードキュメントConfiguring a Web Server

もこのコメントPHPアプリ/コンソールルーターを使用してApacheにすべてのルートをダンプ:ダンプ-apacheの

+0

このチュートリアルでは、仮想ホスト(2番目の仮想ホスト)を使用しました:Webサーバーの構成。今すぐ作品! –