2

I have shared hosting from GoDaddy. I want to create(illusion) sub-domains dynamically from URL parameters.

For e.g. http://example.mydomain.com/value1/value2

points to

http://www.mydomain.com/?domain=example&m1=value1&m2=value2

I have created A wildcard DNS record. I also have added these rules in .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mydomain.com
RewriteCond %{HTTP_HOST} ^(.+).mydomain.com
RewriteRule ^([^/]*)$ http://www.mydomain.com/index.php?domain=%1&m1=$1&m2=$2 [P,L]

But when I open http://example.mydomain.com I get "pageok" as output.

Please help. Thanks in advance.

linpar
  • 71
  • 1
  • 1
  • 7
  • I'm in hostinger.co and i want made the same, but my htaccess script don't work :/ if you can solve this, please helpme. My question is: [My Question](http://stackoverflow.com/questions/32133016/dns-error-with-dynamic-subdomains-with-htaccess). Thanks a lot. – Jjsg08 Aug 21 '15 at 05:50

1 Answers1

0

If you are on shared hosting with GoDaddy, it’s probable they are only configuring their Apache install to pay attention to www.mydomain.com and mydomain.com and nothing else via NameVirtualHost. You would have to see if it’s possible for them to accept any subdomain sent to [subdomian].mydomain.com and then send it to the main site script.

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103