Redirect The Sub Domain To a Sub Folder with .htaccess

Redirect The Sub Domain To a Sub Folder with .htaccess

In this post, I want to explain how to redirect the subdomain to a subfolder with .htaccess. I had implemented this for demos.gravitywebapps.comlab.gravitywebapps.com and downloads.gravitywebapps.com I hope it is useful for you.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^demos\.gravitywebapps\.com$
RewriteCond %{REQUEST_URI} !^/demos/
RewriteRule (.*) /demos/$1
 
RewriteEngine On
RewriteCond %{HTTP_HOST} ^lab\.gravitywebapps\.com$
RewriteCond %{REQUEST_URI} !^/lab/
RewriteRule (.*) /lab/$1
 
RewriteEngine On
RewriteCond %{HTTP_HOST} ^downloads\.gravitywebapps\.com$
RewriteCond %{REQUEST_URI} !^/downloads/
RewriteRule (.*) /downloads/$1

That’s it.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Share This Blog

Comment

Do you want to get our quality service for your business?