Redirect all wordpress posts to a sub-directory

I’m moving a wordpress blog from root to http://website.com/blog. Consequently I need to redirect links such as http://www.website.com/2015/05/post-title to http://www.website.com/blog/2015/05/post-title, http://www.website.com/2014/03/post-title to http://www.website.com/blog/2014/03/post-title, etc. I couldn’t find how to do so correctly with .htaccess.

Related posts

1 comment

  1. Try adding this to the top of your htaccess file in your Document root:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/blog
    RewriteRule ^([0-9]{4}/[0-9]{2}/.*)$ /blog/$1 [L,R]
    

Comments are closed.