2

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.

1

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.

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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