I've redirected my domain http://domain1.com to http://domain2.com using a 301 redirect.
Now i would like to redirect subdomain.domain1.com to domain2.com/folder when the user arrives on that url.
Can I do this in dns? Or in some other way?
Thank you for your help!
You can not do this with DNS. DNS is used to map domain names to IP address(es). It can not resolve a domain to a specific URI.
If you use an Apache server you can achieve this using .htaccess file. You can try adding following lines to the file and see whether it works.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(?:www\.)?subdomain.domain1\.com$
RewriteRule ^(.*)$ http://www.domain2.net/subfolder$1
(or)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.domain1\.com$
RewriteRule ^(.*)$ www.domain2.net/subfolder$1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With