I used to have a Wordpress blog at the root of my domain name and the permalink structure was always simply example.com/name-of-the-blog-post
Now, i've moved that blog to the /blog/ folder AND added a new Wordpress site to the root of my domain. This site, right now, only has 2 pages: /about and /store.
So I have: - 1 wordpress site at / (with 2 pages only) - 1 wordpress site at /blog/ with a full content of blog posts
I need to make sure that all old blog posts that were example.com/name-of-the-blog-post are now /blog/name-of-the-blog-post
EXCEPT the 2 pages example.com/about/ and example.com/store/ that need to remain as is.
How would I write these in my htaccess? Is it 301 redirects or modrewrites? I've looked online but I've not found this exact case anywhere.
EDIT: The closest thing I've tried that works 1/2 the time is this:
RewriteCond %{REQUEST_URI} !^/index\.(php|html)$ [NC]
RewriteCond %{HTTP_HOST} !^example.com [NC]
RewriteRule ^.*$ http://example.com/blog/$0 [R=301,L]
The challenge is this line:
RewriteCond %{HTTP_HOST} !^example.com [NC]
If I write it like this, then the /about and /store pages work fine, but the blog posts don't redirect (404)
If I write it like:
RewriteCond %{HTTP_HOST} !^example.com/ [NC]
Then the blog posts DO redirect but then the /about and /store pages ALSO redirect to /blog/about and /blog/store.