Skip to content

Instantly share code, notes, and snippets.

@lacymorrow lacymorrow/
Last active Aug 31, 2018

What would you like to do?
Moving WordPress appearance to root directory from subdirectory

Moving process (p.s. If you've already installed WP in subdirectory, some steps might be already done automatically).

Create the new location for the core WordPress files to be stored (we will use /wordpress in our examples). (On linux, use mkdir wordpress from your www directory. You'll probably want to use chown apache:apache on the wordpress directory you created.) Go to the General Screen. In WordPress address (URL): set the address of your main WordPress core files. Example: In Site address (URL): set root directory's URL. Example: Click Save Changes. (Do not worry about the errors that happen now! Continue reading) Now move your WordPress core files (from root directory) to the subdirectory. Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address). 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. For the index.php file the instructions remain the same, copy (don't move) the index.php file to your root directory. The web.config file, must be treated differently than the .htaccess file so you must MOVE (DON'T COPY) the web.config file to your root directory. Open your root directory's index.php file in a text editor Change the following and save the file. Change the line that says: require( dirname( FILE ) . '/wp-blog-header.php' ); to the following, using your directory name for the WordPress core files: require( dirname( FILE ) . '/wordpress/wp-blog-header.php' ); Login to the new location. It might now be If you have set up Permalinks, go to the Permalinks Screen 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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.