繁体   English   中英

如何纠正损坏的 WordPress 永久链接

[英]How Can I correct Broken WordPress Permalinks

我的 WordPress 博客遇到了问题。 以前,我可以使用https://mywebsite.com/index.php/all之类的 URL 访问页面。 但是,发生了一些无法解释的事情,因此该 URL 已重命名为https://mywebsite.com/?page_id=102 我试图更改设置下的永久链接结构和链接中断。 当链接显示为https://mywebsite.com/all时,它不会加载到浏览器中。 当我在浏览器 URL 栏中手动将其写入https://mywebsite.com/index.php/all时,它会自动重定向到https://mywebsite.com/all 似乎我不能再使用以前包含在原始 URL 模式中的 index.php 名​​称,因此无法使用人类友好名称访问链接。 我怎么可能解决这个问题?

看起来您的 .htaccess 文件已被覆盖。 最简单的解决方案是将永久链接设置更改回 page_id,然后再次更改为 Post name 它应该覆盖 .htaccess 文件,如果不尝试将其放入您的 .htaccess 中:

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

如果它只是通过在 url 中添加 index.php 来访问所有页面,那么您只需使用自定义永久链接结构来允许 WP 执行此操作。

您提到它显示 page_id 代替名称,因此在永久链接中您可以使用 %postname 为他。 看看截图。

完成此更改后,您的网址将与您要求的相同。

点击查看自定义永久链接截图

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM