3

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:

  1. https://forums.digitalpoint.com/threads/how-to-create-virtual-dymanic-subdomain-in-php-with-htaccess.1521742/

  2. virtual subdomain htaccess

  3. How do i create a virtual subdomain using htaccess?

  4. http://www.webmasterworld.com/apache/3638570.htm

But still my problem is not solved. It always gives Ooops could not find..

Community
  • 1
  • 1
tejas178
  • 133
  • 7

1 Answers1

1

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.

Tom
  • 432
  • 2
  • 9