WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I redirect non existent pages/posts in WordPress using only .htaccess file?

Here is my code:

<IfModule mod_rewrite.c>

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^products/cool-tshirt$ /tshirts [R=301,L]


Thank you in advance.

share|improve this question

This should work:

RedirectMatch 301 ^/products/cool-tshirt$ http://yourdomain.com/tshirts$1

You can also see a bunch of other options and solutions here

Hope this helps.

share|improve this answer
if you review my code you can see that I want to redirect products/cool-tshirt to tshirts when I use the above code it open 404 page. – N. Kirk May 7 '14 at 8:38
Sorry I had misread the question. Edited my answer. – mightypixel May 7 '14 at 8:51
redirect alone doesn't work. It should be RewriteRule – N. Kirk May 7 '14 at 8:58
Also see this question – mightypixel May 7 '14 at 9:12
your last suggestion was ok for me. Thanks. – N. Kirk May 7 '14 at 10:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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