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 know this may seem like a duplicate, but I am unable to find a solution. Is it possible to setup wildcard subdomains with htaccess?

I have an example of

http://test.domain.ca I need to forward to http://www.domain.ca

I don't have specific 'sub-domains'. so I would need a form of a wildcard. Is this possible to do through HTACCESS?

Any help is appreciated.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Short answer: No, it's not possible to setup wildcard subdomains with .htaccess.

To achieve what you want to do, you need to have a wildcard record in your DNS zone file, because your nameserver is where the subdomains are looked up. Also, many hosting companies will not allow you to add a wildcard record, so you'll have to check with them.

share|improve this answer

Do you actually have a * wildcard record in your DNS zone file? If yes then all you need to do is add an A record into the zone file and point it to the IP hosting your domain.ca now all connections to that specific sub domain will go to www.domain.com while the other wildcard subdomains will go some place else.

Or in cPanel you would simply create your test subdomain.

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.