2017-10-02 1 views
0

Ich habe eine Symfony App und ich möchte Wordpress auf dem Unterverzeichnis/Blog ausführen. Die Wordpress-Installation befindet sich in einem eigenen Verzeichnis, nicht im Web-Ordner von Symfony.Wordpress Blog mit Symfony App - Apache Alias ​​Config

Das Problem ist, dass Wordpress die index.php Datei nicht ausführt und wenn ich zu myweb.com/blog gehe, sehe ich die "Index Of" Seite mit einer Liste aller Wordpress Ordner Dateien.

Das ist mein vhost config file:

<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> 

Die Symfony App ist in: var/www/Web-Sites/myweb

Die Wordpress-App ist in: var/www/Web-Sites/mywordpress

Und die Wordpress htaccess ist:

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 

Jede Idee, was ich falsch mache? Danke vielmals.

Antwort

0

Stellen Sie sicher, dass Sie auch die notwendige Konfiguration für Ihre WordPress haben.

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

https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride von hier lesen können Sie sehen, dass, wenn Sie nichts angeben Apache wird nichts von .htaccess-Datei lesen Mit AllowOverride All Apache teilt die .htaccess zu erlauben, die Apache-Konfiguration außer Kraft zu setzen Wenn wollen Sie es strenger dann

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

Fileinfo ermöglichen mod_rewrite Richtlinie und Indizes ermöglichen DirectoryIndex-

0

Dank der Bedienung machen, , es funktionierte! Nach der Alias-Anweisung habe ich folgende Konfigurationszeilen hinzugefügt:

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