Client portal

Redirect all requests to a domain to a subdirectory

 February 4, 2018     0 Comments

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.Connect using FTP

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 "example" with the actual domain, without the TLD (.com, .net, .biz, etc)]

RewriteCond %{HTTP_HOST} ^(www\.)?example\.

# 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.

How helpful was this article to you?

Powered by