Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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)?

share|improve this question
    
Depends on your registrar, and may require premium DNS. Email them. –  bybe Apr 12 '13 at 9:08
1  
@byde: What's "premium DNS" in this sense? AFAIK DNS cannot handle subdirectories/paths. So this is not possible using DNS alone. –  w3d Apr 12 '13 at 9:57
    
It is possible, checkout dyn.com/support/webhops-and-redirections sorry my 1st comment was brief. –  bybe Apr 12 '13 at 22:55

2 Answers 2

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 ^(.*)$ http://domain.com/subfolder/$1 [R=301]
share|improve this answer
    
I do not have access to domain1.com htaccess because I only own the domain for that, which is why I am searching for DNS configuration. +1 for the answer though. :) –  Vivin John Apr 12 '13 at 7:45
    
@Vivin: so you have a DNS entry for domain1.com, a DNS entry for domain2.com, and a server handling requests for domain2.com? –  Ulrich Schwarz Apr 12 '13 at 10:46
    
@Vivin: You can contact your domain registrar for domain1 and ask them to point or redirect your domain name to the desired web address and yes this can be done. :) You can do this yourself if you have been provided a domain management panel by your current registrar which provides the redirection feature. –  Nilabh Apr 12 '13 at 17:14

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

http://myhost.dyndns.org/ redirects to http://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. www.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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.