0

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 1

0

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

1
  • Thanks but I do not want to redirect. I want to remove the /feed from single post URLs. This should be possible in Wordpress and should not need htaccess in Apache. Commented Sep 5 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.