Follow the instructions below to point a domain name to a different directory. In this example I will point my domain from an old WordPress website installed in the root folder to a new WordPress website installed in a different directory.
Modify the .htaccess file
- Locate the .htaccess file located in the root directory of your hosting account using an ftp program or file management cPanel application.
- Move the .htaccess file onto your local hard drive.
- Open a text editing program (Notepad).
- Click on the 'New' options and set the filetype field to 'All Files (*,*)'.
- Navigate to the .htaccess file on your local computer and open it in the text editor program.
- At the end of the text, after 'END WordPress', add the following line of apache code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mywebsite.com$
RewriteRule ^(/)?$ foldername [L]
Note: The red text needs to be changed to match your own setting. The word 'mywebsite.com' needs to be changed to your domain name. The word 'foldername' needs to be the name of your folder with the new WordPress install.
- Save the file using 'ctrl-s' command. If you need to save the file using the 'save as' option, just make sure you don't save it as a '.txt' file. In other words, to save your .htaccess file as a '.htaccess' file, make sure you have the 'Save as type:' set to 'All Files (*,*)'.