V
V
vikholodov2018-09-11 14:48:11
Django
vikholodov, 2018-09-11 14:48:11

How to do rewrite for multilingual subdomains?

Colleagues, I welcome you.
The task is to put a multilingual Django web application on subdomains, sort of like for more efficient indexing by search engines.
You need to magically turn the site.com/en/* url into en.site.com/*
In the nginx config I write:

location /en {
        rewrite ^ http://en.site.com$request_uri permanent;
    }

And as a result I get en.site.com/en/*
With nginx I'm on you, if it's not difficult for you, friends, can you chew in detail how to do these manipulations correctly? I will be extremely grateful!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vikholodov, 2018-09-13
@vikholodov

In general, yes, it turned out to be the easiest way to create subdomains and resolve them through the middleware + redirect from the main domain after determining the language translation.get_language_from_request (request)

W
workbohdan, 2018-09-11
@workbohdan

Maybe this will help: https://stackoverflow.com/questions/9923178/how-do...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question