1

I moved my blog from example.com to example.com/blog. I now have a splash page at example.com. I would like old blog post requests like example.com/2011/example-post to redirect to example.com/blog/2011/example-post; but requests to example.com to be allowed with no redirect.

drew
  • 13
  • 2

1 Answers1

1

Try this:

RewriteEngine On
RewriteRule ^([0-9]{4}/.+)$ /blog/$1 [R=301,NC]

this will redirect all that have digits 4 digits (year) and something after slash so everything you have in example.com will work like regular page example.com/about.html

jcubic
  • 61,973
  • 54
  • 229
  • 402