wordpress 永久链接不起作用 - htaccess 似乎没问题,但在页面上出现 404 错误 [英] wordpress permalinks not working - htaccess seems ok but getting 404 error on pages
问题描述
我将永久链接结构更新为/%postname%/,这更新了我的 .htaccess:
I updated the permalink structure to /%postname%/ and this updated my .htaccess with:
# 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
但我仍然在页面上收到 404 错误.是否还有其他设置需要更改?
But I still get 404 errors on the pages. Are there any other settings that I need to change?
如果它有帮助 apache 日志似乎直接在永久链接的文件夹中查找.即:
if it helps the apache log seems to be looking directly in the permalinked folder. I.e.:
[Wed Oct 16 11:12:32 2013] [error] [client xx.xx.xx.xxx] File does not exist: /var/www/exampledomain/news, referer: http://exampledomain.com/
推荐答案
对于登陆此页面的其他人 - 另一个问题可能是(如果您使用 Apache 作为您的网络服务器)是您的 httpd.conf 或您的 sites-available/sitename.conf 文件需要编辑.
For other people landing on this page - Another issue could be (If you are using Apache as your web server) is your httpd.conf or your sites-available/sitename.conf file needs editing.
您的 Web 目录需要允许 .htaccess 文件覆盖其设置.
Your web directory will need to allow the .htaccess file to override it's settings.
在文件中查找您的网络目录 - 它将位于大部分 conf 文件中或隔离到 VirtualHost 部分.
look for your web dir in the file - it will be in the bulk of the conf file or segregated into a VirtualHost section.
<Directory /path/to/site>
#add the following setting to allow .htaccess in your web dir to work
AllowOverride FileInfo
#other settings ---
</Directory>
这将允许您在 WordPress 中随意设置 WordPress URL.
This will allow you to set up WordPress URLs however you want, within WordPress.
***已编辑 - 谢谢 nietonfir 更新.首先使用最少的权限.如果这不起作用,则将 AllowOverride FileInfo
替换为 AllowOverride All
***Edited - Thank You nietonfir For update. Use the least amount of privilege at first. If this doesn't work then replace AllowOverride FileInfo
with AllowOverride All
这篇关于wordpress 永久链接不起作用 - htaccess 似乎没问题,但在页面上出现 404 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!