Redirecting the main domain to an existing WordPress install
You may have already installed WordPress in a subdirectory on your account. If so, you can configure your account so the primary domain automatically redirects to the WordPress site.
This article describes how to redirect the primary domain to an existing WordPress installation.
For example, you might install WordPress into a subdirectory on your account for testing and development. Later on, however, you want to continue using this installation as the WordPress site for your primary domain. In other words, instead of going to http://www.example.com/wordpress-test to view the WordPress site, you want to be able to just go to http://www.example.com and see the WordPress site.
To do this, you can configure redirection in the .htaccess file in the public_html folder.
Configuring redirection
To configure redirection to the existing WordPress installation, copy and then paste the following directives into the .htaccess file located in the public_html directory. Make sure you replace occurrences of example.com with your own domain name, and occurrences of directory with the name of the directory where you previously installed WordPress:
RewriteEngine on
## Change "example.com" to your own domain name:
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
## Change "directory" to the directory where WordPress is installed:
RewriteCond %{REQUEST_URI}!^/directory/
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
## Change "directory" to the directory where WordPress is installed:
RewriteRule ^(.*)$ /directory/$1
## Change "example.com" to your own domain name:
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
## Change "directory" to the directory where WordPress is installed:
RewriteRule ^(/)?$ directory/index.php [L]
After you make these modifications, use your web browser to load your domain name (for example,http://www.example.com ). The WordPress installation should appear.
Related Articles
Updated 5 days ago