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 towww.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.phpand.htaccessfiles from the WordPress installation directory into the root of your site, same location as Site Address (URL). The.htaccessfile 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 .htaccessfile. Create it empty. - Open your root directory’s
index.phpfile in FTP text editor. - In the
index.phpchange 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
.htaccessfile if it has the appropriate file permissions. If WordPress can’t write to your.htaccessfile, it will display the new rewrite rules to you, which you should manually copy into your.htaccessfile (in the same directory as the mainindex.phpfile.) - You may also need to update your homepage setting, language plugin settings and other plugins, relevant to your site structure.
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.