Full Stack LAMP - MEAN Developer, Python developer. Certified Azure Developer. Freelance programmer/consultant/trainer.

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 implemented this for demos.arjunphp.com,lab.arjunphp.com and downloads.arjunphp.com I hope it is useful for you.

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

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

RewriteEngine On
RewriteCond %{HTTP_HOST} ^downloads\.arjunphp\.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.

0 0 votes
Article Rating
Subscribe
Notify of
guest

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments