Installing WordPress At The Domain Root, But In Its Own Folder

I like to install WordPress in its own directory, but to have it visible directly from the root of domain. It’s easy, more secure, and better organization of the server space. Here’s how to.

First install your wordpress copy in a dedicated directory on your FTP account. It is described here. Don’t enable permalinks yet.

Now you  have WordPress installed in its own folder like, www.yourdomain.co.il/wordpress-installation-folder (give it a meaningful keyword name, for SEO):

  • Go to the General panel in WP Admin.
  • In the box for Site address (URL): change the address to the domain root URL. If your installation is in www.yourdomain.co.il/wordpress-installation-folder, change URL to www.yourdomain.co.il
  • Click Save Changes. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)
  • Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress installation directory into the root of your site, same location as Site Address (URL). The .htaccess file sometimes invisible, so you may have to set your FTP client to show hidden files. Dreamweaver often doesn’t show such files, so sometimes you’ll have to use Filezilla FTP client, or something similar. If you are not using pretty permalinks yet, you may not have a .htaccess file. Create it empty.
  • Open your root directory’s index.php file in FTP text editor.
  • In the index.php change the line that says:
    require('./wp-blog-header.php');

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

    require('./your-wordpress-folder/wp-blog-header.php');
  • Now your wordpress site shows directly from your domain’s root. Login to your admin again, if needed. Latest WP versions don’t require that. It should still be same place as before www.yourdomain.co.il/wordpress-installation-folder/wp-admin/
  • Go to the Permalinks admin page 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.)
  • You may also need to update your homepage setting, language plugin settings and other plugins, relevant to your site structure.
Share:
This entry was posted in WordPress and tagged . Bookmark the permalink.

1 Response to Installing WordPress At The Domain Root, But In Its Own Folder

  1. Interesting. I normally use the built in tools on the server to install wordpress. But, I am installing wordpress on my localhost to mimic my website. I’ll give this a try.

Leave a Reply

Your email address will not be published. Required fields are marked *