You are currently viewing How to 301 Redirect all Subdomains by using htaccess

How to 301 Redirect all Subdomains by using htaccess

There are some ways to redirect all sub-domains , but the very easiest way redirect by using .htaccess

Go to your file manager ,  open your .htaccess ;  if you don’t have .htaccess file into your file manager then create the file and use the following codes :

RewriteEngine On

RewriteCond %{HTTP_HOST} ^[^.]+\.(domain\.com)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L,NE]

 

That’s it .

Jobair Alam Bipul

I'm Jobair Alam, a cPanel Certified WHM/cPanel server administrator and web hosting expert with over 10 years of experience in the industry.

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.