I want to do access www.domain.com/test as test.doamin.com and many more like test2.domain.com,test3.. by creating virtual subdomain through htaccess. I have tried and follow some link but no change found. I think is this because I have shared hosting and subdomains created from cpanel. please provide complete guidance on it.
I followed follwing links:
But still my problem is not solved. It always gives Ooops could not find..
I had the same issue before, you must use cpanel to create the subdomain. If I remember right there was a dns issue with this code:
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} ([^\.]+)\.domain\.com [NC]
RewriteCond %{REQUEST_URI} !^/index [NC]
RewriteRule ^(.*) http://domain.com/%1 [P]
If you don't want to use cpanel creating wildcard domain entry such as *.domain.com should help.