How to have different servers with the same domain? [SOLVED]

I have a website foo.comon us wordpress, and I want to do it foo.com/mexico, foo.com/venezuela, shipping different /serverfor each city with the same domain (no wordpress multisite).

I do not ask for ip detection in the city, but for the server and / or setting up the / dns domain to do this.

I know there are other ways to do this, but I want to know about it.

Here is an example:

http://www.vice.com/pt_br

http://www.vice.com/es_co

Hope I clearly explained :)

SOLUTION DECISIONS

This was my solution:

  • Create a subdomain, example.foo.com, pointing to a different server.
  • Create a folder on the main server with the name that I wanted for the link, for example 'mexico'
  • Inside this folder, .htaccess is created:

    RewriteEngine ON
    RewriteCond% {REQUEST_URI} ^/mexico RewriteRule ^ (. *) $Http://. Foo. com/$1 [R = 301, L, P

. /server, , "venezuela". .htaccess, example.foo.com : foo.com/venezuela.

.

+4
3

, , .

apache mod_proxy. , , nginx. . nginx apache, .

nginx-config , :

server {
    listen       80;
    server_name  example.org  www.example.org;
    location /mexico/ {
        # We could have an apache server running on another port...
        proxy_pass http://127.0.0.1:8000;
    }
    location /venezuela/ {
        # ...or another server.
        proxy_pass http://123.123.123.123:8000;
    }
}
+4

:

1. .

2. - (Apache, NGINX ..)

, Wordpress . (CDN), , , .

+1

A .

SO. , , - , :

one.yourdomain.com β†’ ServerA

two.yourdomain.com β†’ ServerB

GoDaddy . GoDaddy, : https://support.godaddy.com/help/article/4080/managing-a-domain-names-subdomains

, . , DNS. "A Record".

Some registrars just let you enter yoursubdomain, server IP address and TTL (Time To Live).

So, enter your subdomain for your first, the IP address of the server you want to point it to, and TTL (if it asks), which is usually 3600.

Then add another β€œrecord”, only for your other subdomain, IP for this server and TTL.

Repeat if you need a lot of subdomains and servers.

0
source

All Articles