: Help with 301 redirect from subdomain to root domain I need to forward existing subdomain links to the root domain as the subdomain no longer exists. I have tried so many different lines of
I need to forward existing subdomain links to the root domain as the subdomain no longer exists. I have tried so many different lines of code in my .htaccess file and can not get the redirect to work.
The links to the subdomain look like: sub.example.com/dir/y99bb4
Can anyone suggest any code for me?
More posts by @Kevin317
1 Comments
Sorted by latest first Latest Oldest Best
To redirect requests for sub.example.com/uri to example.com/uri:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.example.com$
RewriteRule ^(.*)$ example.com/ [R=301,L]
To redirect requests for sub.example.com/uri to example.com:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.example.com$
RewriteRule ^(.*)$ example.com/ [R=301,L]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.