Any request to www.example.com/* must be redirected to www.example.com/blog/*
If no www. prefix, add it.
Importantly, if there exists any directory matching the request URI, don’t redirect.
Example:
(www.)example.com/<request> -> www.example.com/blog/<request> except <request> === <dirname>
Following the above 3 conditions, how do I code a .htaccess? Please help!
Thx 😉
This should do what you wanted. I also added in a “don’t redirect if this file exists”, since I wasn’t sure what was in your existing directories. You can try removing it by taking out the second
RewriteCondif you don’t want it, but I think it’s probably necessary to some extent.