WordPress Subfolder Installation To Root for Pre-existing Installation explains how easily you can actually change the URLs from you previous subdirectory. WordPress Subfolder Installation To Root falls among Moving WordPress documentation in official WordPress.org website. As it appears, new users who probably with little understanding wrongly or deliberately installs WordPress on subdirectory like /blog/ or /wordpress/ when wants to move one level up works more than actually needed.
WordPress Subfolder Installation To Root for Pre-existing Installation : Practical Example
Typical odd installation of WordPress is Matt Cutts blog :
Those who are not aware of who is Matt Cutts, can search the web for details. The basic thing is that, probably Matt wanted a static custom home page and blog on the sub directory. Although actually it is not needed, with WordPress we an create a Static page; it was intentional. Take that he decided to move the WordPress Subfolder Installation to root, that means WordPress URLs will be without the /blog/ part in url.
But if it happens accidentally or wrongly or you decided to move one level up for any reason, what you will do ? Will you Install a new WordPress on root and move the database selectively in the way we wrote for database repair with moving the wp-content folder ? No. That is basically too much messy way to move WordPress Subfolder Installation To Root. Because WordPress has a nice function to make it easy. Reference WordPress Documentation :
WordPress Subfolder Installation To Root for Pre-existing Installation : Steps
Basically three steps. The official documentation too complex to understand because of a kind of roundabout language.
- First move (not copy) the index.php file from the subdirectory of the WordPress installation to the root of your website. Then open it in a text editor to Edit. The required change is :
This sub-directory can be /blog (in case of Matt Cutts in example) or anything like /wordpress.
- Second there is need of an .htaccess file, which is used for pretty link / permalink structure and other plugins like WorsPress Cache Plugins. Copy (not move) the .htaccess file from the subdirectory of the WordPress installation to the root of your website.
- Before doing the first, always remain logged in your WordPress. Go to the General panel on Settings in WordPress Admin panel. In the field Site address (URL); change the address to point towards the root directory’s URL :
WordPress Address (URL) means where the files of WordPress are located. Site Address (URL) means what will be displayed to the public. As basically the URL are virtual, it works very easily. Go to the Settings > Permalinks settings and just click the button to update your Permalink structure. This actually writes the .htaccess file properly.
WordPress Subfolder Installation To Root for Pre-existing Installation : Other Needed Changes and More Tips
You have to update WP Super Cache or WP Total Cache if the settings was for mod_rewrite. XML Sitemap url also needs to be changed. If you repair the database selectively in the way we wrote for database repair and later change in this way, you can basically repair your working website without any interruption or downtime.