Transparently redirect your root directory to a subdirectory

Depending on how your site is constructed, it may be necessary to redirect requests for the primary URL to a subdirectory. For example, requests to could go to This is most often necessary with One-Click Installs.

Visit the (Panel > ‘Goodies’ > ‘One-Click Installs’) page to view available options.

When installing a One-Click Install:

  • The target directory must be completely empty to succeed.
  • For example, if you want to put the installation in the directory /, this directory must be empty and contain no files.
  • Another solution is to install the software into an empty subdirectory such as; then, you could create rules in an .htaccess file to automatically redirect requests for to

Redirect requests with .htaccess

Redirect "ALL" requests to a domain to a subdirectory

You can redirect all requests to a subdirectory by adding an .htaccess file to the root of your domain’s directory:

  1. Visit the FTP page for instructions on how to upload.
  2. Once connected, upload (or create) a text file named .htaccess (with no extension).
  3. Make sure it’s uploaded to your domain’s directory such as
  4. Add the following content to this .htaccess file:
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} !^/blog/

# Rewrites all URLS [Replace "domain" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.

# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /blog/$1 [L]

This example redirects all requests for a website automatically to a subdirectory named /blog. If you need to redirect to another directory, just change the two references of /blog to your subdirectory.

Redirect "ONLY" the domain's root URL to a subdirectory

The following example provides an alternative method of transparently redirecting. It works with any subdomain (including root/naked domains) and only transparently redirects a root request, while allowing directly requested subdirectories like to be accessed.

RewriteEngine on
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /blog/$1 [L]

Redirecting in WordPress

The redirect feature is included in WordPress. Visit their codex page for instructions on Giving WordPress Its Own Directory.

See also