How to Host WordPress in Alternative or Sub-Directory

Many users asked me how I got the archives tag into my permalinks structure. Well it is basically because I did not want to put all my WordPress files in the root directory, just incase I decided to make other folders with installed MySQL databases and forums / wiki etc. I did not want them to conflict with each other.

So I created https://www.quickonlinetips.com/archives/ and installed WordPress in that folder. But when you visit https://www.quickonlinetips.com/, how do you get to visit my WordPress?

I copy my index.php file from quickonlinetips.com/archives/ to my root folder in quickonlinetips.com/ and modify the following text in the index.php file in a text editor from
require('./wp-blog-header.php');
to
require('./archives/wp-blog-header.php');

which does the trick. I had to remove my index.html file at the root since it now accesses the index.php file instead.

After WordPress login, If I go to Options> General – I have not edited WordPress address (URI) or the Blog address (URI) both of which stay

I hope this will help you place your blog in an alternative directory and still get it working from your root domain name. Remember, this is tricky and if you do not know how this works, do not fiddle with your WordPress settings, which might make your blog unusable.

Share with friends

About the Author: P Chandra is editor of QOT, one of India's earliest tech bloggers since 2004. A tech enthusiast with expertise in coding, WordPress, web tools, SEO and DIY hacks.