Sometimes the simple things are the hardest to figure out and today we are going to show you a simple way to redirect your primary domain to a subfolder on that domain. For the purposes of this tutorial it will redirect to a subfolder at /blog. This is useful if your WordPress blog is installed to a subfolder and you want the main domain to forward to it.
In your public_html folder (also called the “www†folder), you need to create a file called .htaccess
. From this file we are going to use a few lines to redirect those requests in a search engine friendly way.
Add the following lines to that file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$
RewriteRule ^(/)?$ blog [L]
The only change you need to make is to change “YourDomain.com†to your domain. This will then redirect everything from the domain to the folder /blog at that domain. If you want to change that folder just edit the “blog†part.
And you are good to go!