In this post I’m going to explain how to change your wordpress from a Sub-Folder to a Sub-Domain. Learn from here step by step!.
Firstly, create a sub-domain on your Server. This will create a Folder on your Server. For instance, take my domain : http://blog.theonlytutorial.com. Note the “blog”, it is nothing but a folder in my server (root). Actually, all my wordpress files are present inside the folder called “wordpress”. You can also access my blog through this following URL : http://www.theonlytutorials.com/wordpress”
But, I’m pointing out my actual wordpress folder inside the blog folder.
Just follow the simple steps:
Go to admin panel of your wordpress and click the General Link just below the Settings tab. See the picture below
After that change the Site Address (URL) to http://subdomain.maindomain.com (eg. http://blog.theonlytutorials.com). See the picture below to get a clear idea!
Now open your Server Files using any of the FTP Client (eg. FileZilla). The subdomain you created on the server will be available as a Folder in your root folder.
See the picture below:
Now go to wordpress root folder(eg. wordpress/) and search for a file called “index.php”. Download the file on your System and then upload the same “index.php” file to the subdomain (eg. blog) folder.
After you uploaded the “index.php” file on your subdomain (eg.blog) folder. Open the file and edit the following line:
<?php /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); ?>
Line. no 17: Change this line from ” require(‘./wp-blog-header.php’); ” to ” require(‘../yourwordpress/wp-blog-header.php’); ”
That “yourwordpress” is the folder name of your actual wordpress files folder (eg. require(‘../wordpress/wp-blog-header.php’); ).
Now open your domain and see the magic!. That’s it! Guys. Enjoy and comment!