通过Google网站管理员工具查看,我有很多404个永久链接结构为/%年%/%月%/%日%/%postname%的帖子/
此后,我将永久链接更改为/%类别%/%postname%。html
我原以为Wordpress可以将旧的帖子URL重定向到新的帖子URL,但旧的基于日期的URL正在生成404。
我的htaccess文件可写,设置为644。
为什么会发生这种情况?谢谢
通过Google网站管理员工具查看,我有很多404个永久链接结构为/%年%/%月%/%日%/%postname%的帖子/
此后,我将永久链接更改为/%类别%/%postname%。html
我原以为Wordpress可以将旧的帖子URL重定向到新的帖子URL,但旧的基于日期的URL正在生成404。
我的htaccess文件可写,设置为644。
为什么会发生这种情况?谢谢
WordPress无法捕获所有旧URL,您必须帮助它。将以下代码添加到。htaccess上面的WordPress重写规则:
RedirectMatch permanent /\\d+/\\d+/\\d+/(.+)$ /?pagename=$1
这是原件。htaccess在我的本地计算机上 # Block the include-only files. RewriteEngine On RewriteBase / RewriteRule ^wp-admin/includes/ - [F,L] RewriteRule !^wp-includes/ - [S=3] RewriteRule ^wp-includes/js/tinymce/langs/.+\\.php