admin管理员组文章数量:1122832
I have permalinks with a .html
suffix for backwards compatibility. I see in the Google Search console that my posts are getting /feed
added, and as a result I get these URLs that 404:
.html/feed
How can I remove /feed
from the end of the URL for single posts to clean up the 404's, but not remove the overall feed URL that is for the entire site, example/feed
?
I have permalinks with a .html
suffix for backwards compatibility. I see in the Google Search console that my posts are getting /feed
added, and as a result I get these URLs that 404:
https://example.com/2024/08/post-name.html/feed
How can I remove /feed
from the end of the URL for single posts to clean up the 404's, but not remove the overall feed URL that is for the entire site, example.com/feed
?
1 Answer
Reset to default 0You can achieve this by adding the code to .htaccess file of your apache server.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/([0-9]{4})/([0-9]{2})/([^/]+)\.html/feed/?$ [NC]
RewriteRule ^ /%1/%2/%3.html [R=301,L]
The given code will helps you in set up a redirect so that any request to a post URL with /feed
appended will be redirected to the original post URL
without the /feed
suffix.
Using this way, the incorrect URLs won't result in 404 errors
.
本文标签: Remove trailing feed from permalinks that use a html suffix
版权声明:本文标题:Remove trailing feed from permalinks that use a .html suffix 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736295894a1929670.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论