D
D
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)
K
kreativf, 2012-08-30
@kreativf

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.

N
Nikolai Vasilchuk, 2012-08-30
@Anonym

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

E
Eugene, 2012-08-30
@Methos

On masterhost this is called a synonym.

I
Iskander Giniyatullin, 2012-08-30
@rednaxi

I did this using the nginx + apache bundle, maybe it will help:
habrahabr.ru/post/101585/

B
blare, 2012-08-30
@blare

Here I wrote how to make auto-subdomains for the timeweb, maybe it will come in handy for you
http://blare.su/2012/08/how-to-create-automatic-subdomain/

D
Dmitry, 2012-08-30
@gusev

Thanks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question