But now i have to make a seperate rule for every sub domain so im still wondering if there's a better solution.

dklynn
—
2013-03-30T11:13:09Z —
#5

ulthane said:

But now i have to make a seperate rule for every sub domain so im still wondering if there's a better solution.

Yes, create www records in your domain name server. Actually, most hosting accounts are setup to do that for you so I'm surprised that you're having this problem.

Regards,

DK

ulthane
—
2013-03-31T09:32:00Z —
#6

according to my host's instructions i gotta do that through htaaccess, so i would like to see an htaaccess solution please.

dklynn
—
2013-03-31T21:25:37Z —
#7

ulthane,

If that was your host's response, change to a better host (the good ones abound ... but so do ones like yours).

Sub domain names can only be created by DNS records, never by .htaccess. .htaccess files can redirect visitor requests (from one subdomain to another) but that was not your question. If example.com is working and www.example.com is not (I must assume that you've NOT written code to redirect because your www.example returns an error), then the DNS record for www does not exist.

Regards,

DK

ulthane
—
2013-03-31T23:12:16Z —
#8

hey dklynn,I think there's abit of misunderstanding here Now my www. version is also working, it was an htaaccess rule that broke it.

the above rule is used to redirect any subdomain to its folder (like a.example.com to example.com/a, b.example.com to example.com/b and so on)I removed the above htaaccess rule and the www. domain is working fine but now i need to find a new htaacces rule to redirect subdomains to their foldiers, without breaking my www. version of the site.

currently i use this, but i need to repeat it for every sub domain i got:

Another approach is without modifying .htaccess , just set DNZ zone and add www as a CNAME, pointing to yur site's IP address or URL. If you're on cPanel, go to Domains -> Advanced DNS Zone Editor and add www.yourdomain.com. in Name field, Type CNAME , Address - yourdomain.com