I have thousand of error URL with patterns like this


where 74750882288885xxx is a random number, I need help to set this URL to be 301 redirected to


or any URL with pattern /74750882288885xxx/comments/default returning 410 Gone.

Can someone help me with the .htaccess code?

1 Answer 1


Try something like the following at the top of your .htaccess file to redirect the URL:

RewriteEngine On
RewriteRule ^feeds/\d+/comments/default /feeds/ [R=301,L]

The pattern \d+ matches 1 or more digits. If the /comments/default part is not critical to make a match then it can be removed. If just matching a single digit is sufficient then change the regex to read: ^feeds/\d, which would be more efficient.

Or to serve a 410 Gone instead, change the rule to read:

RewriteRule ^feeds/\d+/comments/default - [G]

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.