2017-10-02 5 views
0

私はSymfonyアプリを持っていて、サブディレクトリ/ブログにWordpressを実行したい。 Wordpressのインストールは、Symfonyのwebフォルダではなく、独自のディレクトリにあります。Wordpressのブログ、symfonyのアプリ - Apache Aliasの設定

Wordpressはindex.phpファイルを実行せず、myweb.com/blogに行くと、すべてのwordpressフォルダファイルのリストを含む "Index Of"ページが表示されます。

これは私のバーチャルホストの設定ファイルである:VAR/WWW /ウェブ/ mywordpress

:WordpressのアプリがであるVAR/WWW /ウェブ/ myweb

:symfonyのアプリがである

<IfModule mod_ssl.c> 


<VirtualHost *:443> 
ServerName  www.myweb.com 

DocumentRoot "/var/www/webs/myweb/web" 
DirectoryIndex app.php 

<Directory "/var/www/webs/myweb/web"> 
    AllowOverride None 
    Allow from All 

    <IfModule mod_rewrite.c> 
     Options -MultiViews 
     RewriteEngine On 
     RewriteCond %{REQUEST_FILENAME} !-f 
      RewriteCond %{REQUEST_URI} !^/blog(/.+)? [NC] 
     RewriteRule ^(.*)$ app.php [QSA,L] 
    </IfModule> 
</Directory> 

    Alias "/blog/" "/var/www/webs/mywordpress" 


    RewriteEngine On 
    RewriteCond %{HTTP_HOST} !^www\. [NC] 
    RewriteRule ^(.*) https://www.%{SERVER_NAME}%{REQUEST_URI} [L,R=301] 

    RewriteCond %{HTTPS} off 
    RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301] 


KeepAlive   On 
MaxKeepAliveRequests 200 
KeepAliveTimeout  5 

<IfModule mod_filter.c> 
    AddOutputFilterByType DEFLATE "application/atom+xml" \ 
            "application/javascript" \ 
            "application/json" \ 
            "application/rss+xml" \ 
            "application/x-javascript" \ 
            "application/xhtml+xml" \ 
            "application/xml" \ 
            "image/svg+xml" \ 
            "text/css" \ 
            "text/html" \ 
            "text/javascript" \ 
            "text/plain" \ 
            "text/xml" 
</IfModule> 

<IfModule mod_headers.c> 
    Header append Vary User-Agent env=!dont-vary 

ExpiresActive On 
ExpiresByType image/x-icon "now plus 1 month" 
ExpiresByType image/gif "access 1 month" 
ExpiresByType image/jpg "access 1 month" 
ExpiresByType image/jpeg "access 1 month" 
ExpiresByType image/png "access 1 month" 
ExpiresByType text/css "access 1 month" 
ExpiresByType text/js "access 1 week" 
ExpiresByType application/javascript "access 1 week" 
</IfModule> 
SSLCertificateFile /etc/letsencrypt/live/www.myweb.com/fullchain.pem 
SSLCertificateKeyFile /etc/letsencrypt/live/www.myweb.com/privkey.pem 
Include /etc/letsencrypt/options-ssl-apache.conf 
</VirtualHost> 
</IfModule> 

ワードプレスhtaccessファイルは、次のとおりです。

Options -Indexes 
DirectoryIndex index.php 

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /blog/ 
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /blog/index.php [L] 
</IfModule> 
# END WordPress 

私が間違ってやっているの任意のアイデア?どうもありがとう。

答えて

0

ワードプレスにも必要な設定があることを確認してください。あなたは何も指定しない場合は、Apacheはhtaccessファイルは、Apacheの設定 た場合を上書きできるようにApacheに指示しますAllowOverrideのすべてを使用して、.htaccessファイル から何かを読んでいないだろうことを確認することができ、ここからの読み込み

<Directory "/var/www/webs/mywordpress"> 
    AllowOverride All 
    Allow from All 
</Directory> 

https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride あなたはそれをより厳密にしたい、その後のDirectoryIndex

0

できるようにmod_rewriteのディレクティブおよび索引を許可するように

<Directory "/var/www/webs/mywordpress"> 
    AllowOverride FileInfo Indexes 
    Allow from All 
</Directory> 

のFileInfoを使用するおかげで、 出来た! Aliasディレクティブの後、私はこの設定行を追加しました:

<Directory "/var/www/webs/mywordpress"> 
    DirectoryIndex index.php 
    Options +Indexes 
    AllowOverride All 
    Allow from All 
</Directory>