WordPress 固定链接不保留
在一天中的不同时间点,我的 WP 固定链接不断失效。当我使用自定义权限时,它可以工作,但白天有几次它只会抛出“找不到页面”。我通过将权限设置为默认值,然后返回自定义来修复它,它工作正常。
我的系统管理员无法弄清楚。希望高手能给予帮助吗?
At various points of the day my WP permalinks keep breaking. When I'm using custom perms it works but then a few times during the day it just throws a Page Not Found. I fix it by setting perms to default, then back to custom and it works fine.
My Sys Admin can't figure it out. Hopefully a guru can lend some help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
问题确实很可能是 sCategory Permalink 插件(为您提供
/%scategory%/
的插件)。404 有点常见。转到选项 | 站点管理中的永久链接页面,然后单击保存更改以重新生成永久链接。 ="http://codex.wordpress.org/Using_Permalinks" rel="nofollow">WP 默认永久链接 用于测试行为 如果一切正常,则为 sCategory 永久链接。如果这不起作用,请发布您的 .htaccess,这将帮助我们更好地排除故障。
The problem is indeed most-likely the sCategory Permalink plug-in (the one that gives you
/%scategory%/
. 404s are somewhat common. Go to Options | Permalinks page in Site Admin and click Save Changes to regenerate permalinks. They way to confirm this is to use WP-default permalinks to test behavior. If all is working well, it is the sCategory Permalink.If this isn't working, publish your .htaccess and that will help us troubleshoot better.
我怀疑某些东西会定期覆盖您的 .htaccess 文件。当您设置永久链接选项时,它会更新 .htaccess。如果这些设置“丢失”,则可能是您的网站上运行了另一个软件,该软件正在破坏 .htaccess 文件并删除或覆盖 WordPress 设置。
I'd be suspicious of something that is periodically overwriting your .htaccess file. When you set the permalink options, it updates .htaccess. If those settings are being "lost", there might be another piece of software running on your site that is mucking with the .htaccess file and removing or overriding the WordPress settings.
似乎有其他东西会自动更改您的 htaccess 文件并覆盖永久链接设置。
bvandrunen 的建议可能有效。如果没有,您可以将永久链接设置设置为您想要的,然后立即更改 htaccess 文件的权限以防止任何人对其进行修改。我建议使用
chmod 644
。当然,更好的解决方案仍然是找到正在修改 htaccess 文件的脚本并删除它......但是这个修复至少应该让你的永久链接正常工作!
It seems that something else is automatically changing your htaccess file and overwriting the permalink settings.
What bvandrunen suggested may work. If not, you could set the permalink settings to what you want and then immediately change the permissions of the htaccess file to prevent anything from modifying it. I would suggest using
chmod 644
.Naturally, a better solution still would be to find the script which is modding your htaccess file and get rid of it... but this fix should at least keep your permalinks working!
.htaccess 的创建/修改日期是否改变?即使您在 .htaccess 中没有看到任何明显的变化?
永久链接存储在 wp_options 表中的 option_id 34 中。检查它们,然后在更改发生后检查。
Do the creation/modification dates of .htaccess change or not? Even if you see no visible changes in .htaccess?
Permlinks are stored in the wp_options table in option_id 34 . Check them and then check after the change takes place.
那应该有效。
That should work.
您可以尝试在您网站的 Nginx 配置文件中使用“try_files”指令:
a) 打开位于 '/etc/nginx/sites-enabled/yoursite.conf' 或 处的配置文件>'/etc/nginx/conf.d/default.conf'
b) 然后在 location / 块下添加以下行:
c) 应该看起来像:
您还可以查看 WordPress 自定义永久链接和 Nginx 了解详细信息。
You can try using the 'try_files' directive in the Nginx configuration file for your website:
a) Open the configuration file present at ‘/etc/nginx/sites-enabled/yoursite.conf’ or ‘/etc/nginx/conf.d/default.conf’
b) Then add the following lines under the location / block:
c) It should look like:
You may also check out WordPress custom permalinks and Nginx for detailed information.
我必须同意@ahockley 的观点,因为我的 WordPress 博客也遇到了同样的问题。发生的情况是
.htaccess
文件被覆盖,然后当您将其设置为自定义然后返回默认值时,它会自行纠正一段时间。我必须做的是这样的:(这是默认的)更改为:
一旦我将 # BEGIN Wordpress 移出块,问题就停止了。希望这有帮助
I would have to agree with @ahockley since I had this exact same problem with my WordPress blog. Which is happening is that the
.htaccess
file is getting overwritten and then when you set it to custom and then back to default it corrects itself for a while. What I had to do was something like this: (this is the default)Change to:
Once I moved the # BEGIN Wordpress out of the blocks the problem stopped. Hope this helps
.htaccess 没有随我的构建一起上传!
我的构建过程中犯了一个愚蠢的错误!
.htaccess wasn't uploaded with my build!!!
A stupid mistake in my build process!
您可能需要检查服务器限制。当 MySQL 空间不足时,我们遇到了这个问题。在 SSH 中时,用于
列出文件并查看是否有任何空间不足
You may want to check server limits. We had this issue when MySQL was running out of space. When in your SSH, use
to list files and see if anything has run out of space