: I want to redirect subdomain.domain1.com to domain2.com/directory using DNS I own 2 domain names "domain1.com" and "domain2.com", I want to redirect subdomain.domain1.com to domain2.com/directory using
I own 2 domain names "domain1.com" and "domain2.com", I want to redirect subdomain.domain1.com to domain2.com/directory using DNS (preferably). Can anyone assist (I am an amateur at domain management)?
More posts by @Megan663
2 Comments
Sorted by latest first Latest Oldest Best
Some premium dns providers provide extra features at dns level such as Dyn do.
Quote on Dyn's Webhop service
Redirecting a Subdomain to a Subdirectory
EXAMPLE
myhost.dyndns.org/
redirects to
myserver.dyndns.org/~myhomepage/
In many instances, you may wish to redirect from a subdomain (e.g.
subdom.domain.com) to a subdirectory of your main site (e.g.
domain.com/subdir). While creating a WebHop redirect is a simple
enough solution, a better solution is to use either virtual hosting or
a 301 server-side redirection instead..
While the quote isn't a 100% match it should in theory and gives you an idea that 'somethings' can be done at dns level, however they do advise that this should ideally be done at hosting level, if you do consider this a viable solution ensure you question them beforehand as I do not have firsthand experience but have heard of others doing it a similar way.
You can use a simple redirect pointing subdomain.domain1.com to domain2.com/directory.
In order to do this open your public_html folder.
You will see a .htaccess file present under the public_html folder.
Add this code in the .htaccess file:
RewriteCond %{HTTP_HOST} ^subdomain.domain.com
RewriteRule ^(.*)$ domain.com/subfolder/ [R=301]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.