Pointing WordPress website’s domain to sub-directory
If you happened to fall on this tutorials by searching all over the internet about how to point your website’s domain to already existing sub-directory (where your wordpress is installed) then you’re at the right place.
So First thing first, go into your sub-directory and check if there is .htaccess file or not, if yes, then delete that file.
Now go to permalinks tab in settings and change your default permalink structure to something else and hit save. This will create .htaccess file for you go and check in your sub-directory. Now don’t touch that file yet, go again in your settings and click on general settings.
Here you have change Site Address (URL) to your domain ( e.g. http://example.com/wordpress TO http://example.com) And make you’re changing Site Address (URL) not WordPress Address (URL), save the changes you’ve made.
Now copy (not move) .htaccess file and index.php from your sub-directory to root of your website. After copying open index.php from root in text-editor. Here you have to make following change and save the file.
Change the line that says:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to the following, using your directory name.:
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
Now one last step, go again into your permalinks and change the structure of permalinks to your default one which was already there before you changed or to any it doesn’t matter.
Well, That’s it, go type url of your website (e.g. www.example.com) and you’ll see site’s running fine.