Dmitry2012-08-30 09:36:38
Apache HTTP Server
Dmitry, 2012-08-30 09:36:38

3-level domain via .htaccess, how?

There is a 2nd level site on host-ed.net hosting, you need to add about 30 3rd level domains, the hosting has a limitation - only one 3rd level subdomain. I decided to implement it through .htaccess
RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^www\.site\.ru$ RewriteCond %{HTTP_HOST} (www\.)?(.*)\.site\.ru$ RewriteCond %{REQUEST_URI} !public_html/ RewriteRule ^(.*)$ public_html/%2/$1
. I uploaded the region folder into the public_html folder into it index.html, but when I click on the link region.site.ru it gives an error, tell me how to implement it?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
kreativf, 2012-08-30

Only through .htaccess will not work. For your option, you need your provider to set up a wildcard for a third-level domain, and apparently he will not configure this.

Nikolai Vasilchuk, 2012-08-30

No way. The third-level domain must be resolved, for this you need a DNS record.

Eugene, 2012-08-30

On masterhost this is called a synonym.

Iskander Giniyatullin, 2012-08-30

I did this using the nginx + apache bundle, maybe it will help:

blare, 2012-08-30

Here I wrote how to make auto-subdomains for the timeweb, maybe it will come in handy for you

Dmitry, 2012-08-30


Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question