A
A
Alexander Lebedev2015-10-05 10:00:41
Domain name market
Alexander Lebedev, 2015-10-05 10:00:41

How to link a subdomain to a website directory?

Good morning.
Suppose I have site.ru. I want the food.site.ruuser to see the directory site.ru/foodwhen navigating through the subdomain, and when navigating through the subdomain drinks.site.ru, the site.ru/drinks directory is shown.
How to set it up with a simple redirect through .htaccess- I understand. Is it possible to make the subdomain stay in the address bar? The directories have one-page sites and any navigation through them is not needed.
I will be grateful for any advice. Thanks :)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
HoHsi, 2015-10-05
@HoHsi

nginx config

server {
        listen       80;
        server_name  site.ru *.site.ru;

        location / {
            if ($host ~* ^(food|drinks)) { # или ^(.+)\. - для любого
                proxy_pass  http://site.ru/$1;
            }
       }
}

The question is whether search engines will appreciate it, because they count subdomains as a new indexing space.

K
kmx, 2015-10-05
@kmx

for apache like this

<VirtualHost *:80>
    ServerName www.site.ru
    ServerAlias *.site.ru
    VirtualDocumentRoot "D:/www/vhosts/site.ru/%1"
</VirtualHost>

O
OnYourLips, 2015-10-05
@OnYourLips

Create a virtual host for the webserver.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question