使用永久链接时Wordpress Post / Pages重定向,使用默认设置时不重定向(Wordpress Post/Pages redirect when using permalinks and

编程入门 行业动态 更新时间:2024-10-24 14:26:54
使用永久链接时Wordpress Post / Pages重定向,使用默认设置时不重定向(Wordpress Post/Pages redirect when using permalinks and do not when using default settings)

我有一个网站,我使用永久链接,如/%category%/%postname%/。

他们在一两个星期前工作正常。 现在,当我想要进入页面时,会收到一条错误,告诉我页面未正确重定向。

我的htaccess文件中没有重定向。 没有。 如果我将永久链接更改为默认值,那么每个页面/帖子都可以正常工作。

我不知道该怎么办。 请帮忙

这是.htaccess

<ifModule mod_headers.c> ExpiresActive On # Expires after 1 month <filesMatch ".(gif|png|jpg|jpeg|ico|pdf|js|htm|html|txt)$"> Header set Cache-Control "max-age=2592000" </filesMatch> # Expires after 1 day <filesMatch ".(css)$"> Header set Cache-Control "max-age=2592000" </filesMatch> </ifModule> # BEGIN W3TC Browser Cache <IfModule mod_deflate.c> <IfModule mod_headers.c> Header append Vary User-Agent env=!dont-vary </IfModule> AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json <IfModule mod_mime.c> # DEFLATE by extension AddOutputFilter DEFLATE js css htm html xml </IfModule> </IfModule> # END W3TC Browser Cache # 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

I have a webiste on which I use permalinks like /%category%/%postname%/ .

They were working fine a week or two ago. Now when I want to enter a page a get an error telling me that the page is not redirected correctly.

I have no redirects made in my htaccess file. NONE. If I change the permalinks to default then every page/post works fine.

I do not know what to do. Please help

Here is the .htaccess

<ifModule mod_headers.c> ExpiresActive On # Expires after 1 month <filesMatch ".(gif|png|jpg|jpeg|ico|pdf|js|htm|html|txt)$"> Header set Cache-Control "max-age=2592000" </filesMatch> # Expires after 1 day <filesMatch ".(css)$"> Header set Cache-Control "max-age=2592000" </filesMatch> </ifModule> # BEGIN W3TC Browser Cache <IfModule mod_deflate.c> <IfModule mod_headers.c> Header append Vary User-Agent env=!dont-vary </IfModule> AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json <IfModule mod_mime.c> # DEFLATE by extension AddOutputFilter DEFLATE js css htm html xml </IfModule> </IfModule> # END W3TC Browser Cache # 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

最满意答案

解决wordpress重定向问题的一般方法:(应该适用于所有情况)

/wp-admin/options-permalink.php 单击“保存更改” 。 这将刷新WP重定向规则。 检查.htaccess ,尝试评论除WP部分之外的所有内容。 尝试临时禁用插件 。 快速方法是重命名wp-content / plugins /文件夹,WP不会禁用插件,只是不会加载它们。 注意:当重命名wp-content / plugins /时,不要访问/wp-admin/plugins.php,因为WP会自动禁用它们。 检查你的主题文件,functions.php,尝试激活WP另一个/默认主题进行测试。 如果以上不起作用,请下载新的WP版本。

提示:尝试永远不要更改wp-admin /或wp-includes /文件夹中的文件。 这些将来会带来灾难。

Very general way to fix wordpress redirect issues: (should work in all cases)

/wp-admin/options-permalink.php Click "save changes". this will refresh WP redirect rules. check .htaccess, try to comment everything except WP part. Try to temporary disable plugins. Quick way is to rename wp-content/plugins/ folder, WP will not disable plugins, just will not load them. ATTENTION: do not visit /wp-admin/plugins.php when wp-content/plugins/ is renamed, becouse WP would auto disable them all. check your themes files, functions.php, try to activate WP another/default theme for test. If above do not work, download new fresh WP version.

TIP: try to never change files in wp-admin/ or wp-includes/ folder. These gives disaster in future.

更多推荐

本文发布于:2023-04-29 08:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335892.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不重   默认设置   重定向   链接   Post

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!