WordPress 固定链接不保留

发布于 2024-09-15 11:35:56 字数 133 浏览 5 评论 0原文

在一天中的不同时间点,我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

‘画卷フ 2024-09-22 11:35:57

问题确实很可能是 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.

晚雾 2024-09-22 11:35:57

我怀疑某些东西会定期覆盖您的 .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.

混吃等死 2024-09-22 11:35:57

似乎有其他东西会自动更改您的 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!

呆萌少年 2024-09-22 11:35:57

.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.

薄凉少年不暖心 2024-09-22 11:35:57
  1. 删除现有的永久链接结构并将其设置为默认值。
  2. 删除当前的 .htaccess 文件。
  3. 清除您的网站缓存。
  4. 像 @bvandrunen 建议的那样编写一个新的 .htaccess 文件。
  5. 再次创建新的永久链接结构。

那应该有效。

  1. Delete the existing Permalink structure and set it to default.
  2. Delete the current .htaccess file.
  3. Purge your site cache.
  4. Write a new .htaccess file like @bvandrunen suggested.
  5. Create your new permalink structure again.

That should work.

揽月 2024-09-22 11:35:57

您可以尝试在您网站的 Nginx 配置文件中使用“try_files”指令:

a) 打开位于 '/etc/nginx/sites-enabled/yoursite.conf'处的配置文件>'/etc/nginx/conf.d/default.conf'

b) 然后在 location / 块下添加以下行:

try_files $uri $uri/ /index.php?$args;

c) 应该看起来像:

location / {
    root   /var/www/html;
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
}

您还可以查看 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:

try_files $uri $uri/ /index.php?$args;

c) It should look like:

location / {
    root   /var/www/html;
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
}

You may also check out WordPress custom permalinks and Nginx for detailed information.

过期情话 2024-09-22 11:35:57

我必须同意@ahockley 的观点,因为我的 WordPress 博客也遇到了同样的问题。发生的情况是 .htaccess 文件被覆盖,然后当您将其设置为自定义然后返回默认值时,它会自行纠正一段时间。我必须做的是这样的:(这是默认的)

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

更改为:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# BEGIN WordPress

# END WordPress

一旦我将 # 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)

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Change to:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# BEGIN WordPress

# END WordPress

Once I moved the # BEGIN Wordpress out of the blocks the problem stopped. Hope this helps

待天淡蓝洁白时 2024-09-22 11:35:57

.htaccess 没有随我的构建一起上传!

我的构建过程中犯了一个愚蠢的错误!

.htaccess wasn't uploaded with my build!!!

A stupid mistake in my build process!

情丝乱 2024-09-22 11:35:57

您可能需要检查服务器限制。当 MySQL 空间不足时,我们遇到了这个问题。在 SSH 中时,用于

df -h 

列出文件并查看是否有任何空间不足

You may want to check server limits. We had this issue when MySQL was running out of space. When in your SSH, use

df -h 

to list files and see if anything has run out of space

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文