(This is the first post in a serie of posts about WordPress that I’m working on.)
I guess that you all can install WordPress. WordPress is quite known for its “5-minute-install”, and almost every web hosting provider usually have a “Click one button to install WP”-option. Maybe I will write a short post about installing WordPress on your server later.
But how should you do if you want to move your installed WordPress to a new directory. Maybe you don’t want to have a cluttered root directory on your server. You can have many reasons to have WP installed in a directory other than the root directory, both for security reasons and to unclutter your directory tree.
Let’s say that you want have your URL, for example http://mydomain.com to reach your website, but you want to have WordPressed installed in a subdirectory, like http://mydomain.com/wpsystem/. Your visitors will see it like your WordPress is installed in the root directory, but you have to go to http://mydomain.com/wpsystem/wp_admin/ to log in to the admin dashboard.
For simplicity we will say that you already has installed WP in the root directory and want to move it to the /wpsystem directory. The first thing you should do is to log in to your admin dashboard, and go to Settings -> Permalinks. There you can set up the system to use the kind of links you want to use for your site, like “Post Name”, which gives http://mydomain.com/post-name/ as link structures.
After that you go to Settings ->General Settings, and change the WordPress Address (URL) to http://mydomain.com/wpsystem, and the Site Address (URL) to http://mydomain.com.
The WordPress Address should point to where you will have your WordPress system installed, and Site Address should point to the web address where your visitors will go to visit your website.
Remember to click on the “Save Changes”-button to update the system and publish your new settings.
After that you can use a regular FTP program to move all files to the new directory, except for the index.php and .htaccess files. This two files should remain in the root directory.
When the files have been moved, you open the index.php file in your editor and look for this code:
require ( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );
and replace it with this code instead:
require ( dirname( __FILE__ ) . ‘/wpsystem/wp-blog-header.php’);
After doing that you might have to log in to the Admin Dashboard (now at http://mydomain.com/wpsystem/wp-admin/) to update the permalink settings again, and after that you’re done.