How To Fix: Redirect WordPress (installed in a directory) to main web address?

Sometimes you may want to install WordPress into one of your folders like for future-proofing, or you know that your main page will contain something else. I had this problem when creating my blog, I’ve tried to use domain redirection to the blog page, but it creates a massive amount of redirections and ultimately failed. Don’t use them in this case.


If You look from the user point of view, all I wanted is to type my website address (www.) and have it redirected to /blog folder. The root directory for the site is, but the root for WordPress is /blog, so when you type your webpage name, it will list a folder in the web browser. We don’t want that.


Go to Settings in WordPress and see if Your settings below are the same, keep the Setting page open:

WordPress Address (URL):
Site Address (URL):

If you still use HTTP:// instead of secure HTTPS:// version then You should find out how to change it. 

Log in via FTP to your site or if you are using BlueHost like me, log in to your Domain account, then Advance option, followed by File Manager and find Your blog/ folder. COPY (do not move it) the .htaccess and index.php to the main root of your website. When you are connecting to the site via a browser, it first looks for the index file. Edit .htaccess file and see if RewriteBase /blog/ is there, if not change RewriteBase / to RewriteBase /blog/ so it’s pointing to your actual WordPress installation.

If You use Bluehost, go to Advanced
If You use Bluehost, pick File Manager

Go to the root directory of your website and start editing Your new copy of index.php. Change the line:

 require( dirname( __FILE__ ) . '/wp-blog-header.php' ); 

to the folder, that has your WordPress installation, in our case /blog/

 require( dirname( __FILE__ ) . '/blog/wp-blog-header.php' ); 

Save the index.php.

Login to WordPress admin account via check the Site Address, it should be your full web address without the installation folder: Sometimes you may have a problem with some pages not being accessible and with Error 404 on your blog. In this case, keep those addresses the same with installation folder like and try again opening this page. If everything went ok, you should be able to type your web address and be redirected to If you use permalinks, go to Settings and update them as well. Don’t forget to copy the .htaccess file to your main folder to update the changes. Those files will not be auto-updated when you do changes, and you have to do it yourself.

You may also like...