Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Moving WordPress From A Subdirectory  (Read 2809 times)

0 Members and 1 Guest are viewing this topic.

sajugovind

  • Guest
Moving WordPress From A Subdirectory
« on: January 12, 2014, 06:17:24 pm »
Many people install WordPress as a “test” in a subdirectory off of their root web directory.  Like http://yourdomain.com/wordpress.  This allows them to keep their main site up while they develop and test the WordPress installation.

When it comes time to go live with their WordPress site, they frequently are advised to move the files to the web root and make many adjustments throughout the installation.  This is simply not needed.

You only need to handle 3 files at the most.

If you have installed WordPress in a subdirectory (like http://yourdomain.com/wordpress) and want to move it to the web root (http://yourdomain.com) you do not need to move the entire install. This is a common error made by many and results in a multitude of unneeded steps to get the site working again.

Please follow these steps (From the WordPress Codex):

Go to the General panel in your WordPress Dashboard.

1.  In the box for Site address (URL): change the address to the root directory’s URL. Example: http://yourdomain.com Click Save Changes. (Do not worry about the error message if you get one and do not try to see your blog at this point! You will probably get a message about file not found.)

2.  Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress (wordpress in our example) directory into the root directory of your site — the latter is probably named something like www or public_html. The .htaccess file is invisible, so you may have to set your FTP client to show hidden files. If you are not using pretty permalinks, then you may not have a .htaccess file. If you are running WordPress on a Windows (IIS) server and are using pretty permalinks, you’ll have a web.config rather than a .htaccess file in your WordPress directory.

3.  Move (DON’T COPY!) the wp-config.php file to your root directory.

4.  Edit your root directory’s index.php. Open your root directory’s index.php file in a text editor.  Change the line that says:

        require(‘./wp-blog-header.php’);


to the following, using your directory name for the WordPress core files:

        require(‘./wordpress/wp-blog-header.php’);

Save the file.

5.  Login to your site (if you aren’t still already). The URL should still be http://example.com/wordpress/wp-admin/  If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can’t write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)

Since the site is not working for some of these steps, it is best to make this change at a time of low activity, e.g., the middle of the night.