只有默认的永久链接可以正常工作,WordPress会变成404错误 [英] only default permalinks working wordpress others become 404 error
问题描述
我的问题是在我的wordpress网站中,只有默认的永久链接有效..当我更改永久链接时,找不到所有页面..仅显示了首页.
My problem is in my wordpress site only default permalinks is working.. When I change permalinks all pages become not found.. only home page is showing.
当我将永久链接更改为邮政名.htaccess内容更改为
When I change permalinks to postname .htaccess content change to
# 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
默认情况下是
# BEGIN WordPress
# END WordPress
还尝试使用此方法获取mod_rewrite的状态
Also tried to get the status of mod_rewrite using this
in_array( 'mod_rewrite', apache_get_modules())
它返回1,并且在我的服务器上启用了mod_rewrite,并且还使用phpinfo()进行了检查. mod_rewrite
模块已加载..我已经浏览了Internet上的所有文档..请帮助我解决此问题..我的托管服务器是godaddy ..
It returns 1 and mod_rewrite is enabled on my server and also checked using phpinfo(). mod_rewrite
module is loaded.. I have gone through all the documents available in internet.. Please help me to solve this problem.. My hosting server is godaddy..
推荐答案
它可能是数据库中损坏的rewrite_rules
字段.
It could be a broken rewrite_rules
field in your database.
我在一个实时站点中安装了"Yoast SEO",这完全破坏了它.我禁用了该插件,但它没有恢复正常工作.只有默认的永久链接有效.
I installed "Yoast SEO" into a live site and that broke it completely. I disabled the plugin but it didn't go back to working. Only default permalinks would work.
像其他所有人一样,我尝试了常规操作-检查.htaccess
,确保mod_rewrite
在服务器上正常工作,再次保存永久链接设置,但是没有任何反应.将加载主页,并加载wp-admin
页,但其他所有内容都仅加载最新帖子"默认页面.
Like everyone else I tried the usual things - checking .htaccess
, making sure that mod_rewrite
was working on the server, saving the permalinks settings again, but nothing was working. The homepage would load, and wp-admin
pages would load, but everything else was just loading the "Latest Posts" default page.
最后,事实证明数据库中wp_options
的rewrite_rules
字段有问题.
In the end it turned out to be something wrong with the rewrite_rules
field of wp_options
in the database.
我有该站点的三个版本(本地,暂存和生产),并且所有版本均来自一个SVN站点,因此我知道这不是文件问题.但是只有本地开发版本在起作用.
I had three versions of the site (local, staging and production), and all were from one SVN base, so I knew it was not a file issue. But only the local development version was working.
我用本地开发站点中的工作站点替换了损坏的活动站点的rewrite_rules
字段中的内容,并且该站点正常工作.
I replaced the contents of the rewrite_rules
field of the broken live site with the working one from my local development site, and it worked.
真正奇怪的是,删除rewrite_rules
字段并让WordPress重建它并不能解决问题.只能用网站先前可用版本的内容代替.
What's really weird is that deleting the rewrite_rules
field and having WordPress rebuild it did not fix the problem. Only replacing with the contents of a previously working version of the site did the trick.
我对此仍然感到困惑,如果我发现有关该问题的更多信息,将编辑此答复.
I'm still puzzled by this, and will edit this reply if I find out anything further about the problem.
这篇关于只有默认的永久链接可以正常工作,WordPress会变成404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!