I want to redirect the url if it contains the string like /blog/abcd.../ to blog listing page i.e. /blog page. I used a to code in htaccess file.

Redirect 301 /blog/abcd http://www.example.com/blog

But the browser says Too many redirect error. I think Wordpress also do a redirection for blog single post that is /blog/abcd to /abcd. Can we force htaccess to do redirect if url contains /blog/ to blog listing page.


A URL like /blog/abcd.../ will redirect to the 404 page, you can redirect the 404 page to the blog page, This plugin will do what you want.

| improve this answer | |

I have done it by the following code

RewriteRule  /blog/([A-Za-z0-9-]+)/  http://www.example.com/blog  [NC,L]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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