问题描述
我将永久链接结构更新为/%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作为Web服务器)是您的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.
您的网络目录将需要允许.htaccess文件覆盖其设置.
Your web directory will need to allow the .htaccess file to override it's settings.
在文件中查找您的Web目录-该目录将位于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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!