【发布时间】:2016-02-05 23:04:14
【问题描述】:
我刚刚将一个带有 WooCommerce 的现有 WordPress 站点转移到一个新的 CentOS 服务器上。
我创建了一个虚拟主机,如下所示:
<VirtualHost *:80>
ServerName www.mysite.com
DocumentRoot "/var/www/website/public_html"
<Directory "/var/www/website/public_html">
Options Indexes FollowSymLinks MultiViews
# AllowOverride controls what directives may be placed in .htaccess files.
AllowOverride All
# Controls who can get stuff from this server file
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
ErrorLog /var/www/website.co.uk/error.log
CustomLog /var/www/website.co.uk/requests.log combined
</VirtualHost>
然后我安装了所有文件并导入了数据库。
问题是,每当我访问除主页以外的任何其他页面时,使用“帖子名称”固定链接都会收到 404 错误。例如,访问/shop 会出现 404 错误,但是我可以在使用普通格式时通过 /?p=4 访问商店页面,这只会创建以下 .htaccess 文件:
# BEGIN WordPress
# END WordPress
但是,每当我执行诸如帖子名称之类的操作时,都会输入以下内容:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
mod_rewrite.c 已启用,因为我在我的 phpinfo() 内容中找到了它。
对我哪里出错有什么想法吗?
编辑:如果我这样做:
RewriteEngine On
asfl;asjflasfj
它显示为内部服务器错误。
【问题讨论】:
-
你检查过日志文件吗?
-
@CBroe 请查看更新
标签: php wordpress apache .htaccess mod-rewrite