Wordpress博客和Symfony应用程序-Apache别名配置
我有一个Symfony应用程序,我想在子目录/博客上运行Wordpress。Wordpress安装在自己的目录中,不在Symfony的web文件夹中 问题是Wordpress不执行index.php文件,当我转到myweb.com/blog时,我会看到“index Of”页面,其中包含所有Wordpress文件夹文件的列表 这是我的vhost配置文件:Wordpress博客和Symfony应用程序-Apache别名配置,wordpress,apache,symfony,Wordpress,Apache,Symfony,我有一个Symfony应用程序,我想在子目录/博客上运行Wordpress。Wordpress安装在自己的目录中,不在Symfony的web文件夹中 问题是Wordpress不执行index.php文件,当我转到myweb.com/blog时,我会看到“index Of”页面,其中包含所有Wordpress文件夹文件的列表 这是我的vhost配置文件: <IfModule mod_ssl.c> <VirtualHost *:443> ServerName w
<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>
服务器名www.myweb.com
DocumentRoot“/var/www/webs/myweb/web”
DirectoryIndex app.php
不允许超限
通融
选项-多视图
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_URI}^/博客(/。+)?[北卡罗来纳州]
重写规则^(.*)$app.php[QSA,L]
别名“/blog/”/var/www/webs/mywordpress”
重新启动发动机
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写规则^(.*)https://www.%{SERVER_NAME}%{REQUEST_URI}[L,R=301]
重写条件%{HTTPS}关闭
重写规则^(.*)https://%{SERVER_NAME}%{REQUEST_URI}[L,R=301]
继续
MaxKeepAliveRequests 200
保持超时
AddOutputFilterByType DEFLATE“应用程序/atom+xml”\
“应用程序/javascript”\
“应用程序/json”\
“应用程序/rss+xml”\
“应用程序/x-javascript”\
“应用程序/xhtml+xml”\
“应用程序/xml”\
“图像/svg+xml”\
“文本/css”\
“文本/html”\
“文本/javascript”\
“文本/纯文本”\
“文本/xml”
标头附加变量用户代理env=!不要改变
过期于
ExpiresByType图像/x图标“现在加1个月”
ExpiresByType image/gif“访问1个月”
ExpiresByType图像/jpg“访问1个月”
过期按类型图像/jpeg“访问1个月”
ExpiresByType图像/png“访问1个月”
ExpiresByType文本/css“访问1个月”
ExpiresByType文本/js“访问1周”
ExpiresByType应用程序/javascript“访问1周”
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
symfony应用程序位于:var/www/webs/myweb
Wordpress应用程序位于:var/www/webs/mywordpress
而wordpress 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
选项-索引
DirectoryIndex.php
#开始WordPress
重新启动发动机
重写库/博客/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/blog/index.php[L]
#结束WordPress
知道我做错了什么吗?非常感谢。确保您的wordpress也有必要的配置
<Directory "/var/www/webs/mywordpress">
AllowOverride All
Allow from All
</Directory>
允许超越所有
通融
从这里可以看到,如果不指定任何内容,apache将不会从.htaccess文件中读取任何内容
使用AllowOverride All告诉apache允许htaccess覆盖apache配置
如果你想让它更严格,那么使用
<Directory "/var/www/webs/mywordpress">
AllowOverride FileInfo Indexes
Allow from All
</Directory>
AllowOverride文件信息索引
通融
FileInfo允许mod_rewrite指令,index允许DirectoryIndex谢谢,成功了!在Alias指令之后,我添加了以下配置行:
<Directory "/var/www/webs/mywordpress">
DirectoryIndex index.php
Options +Indexes
AllowOverride All
Allow from All
</Directory>
DirectoryIndex.php
选项+索引
允许超越所有
通融