Using subdomains for redirection only (Special for Django)

Suppose that my domain is example.com

I want to set subdomains such as blog.example.com, contact.example.com

In my use case:

  • The subdomains will never have unique content.
  • They will always redirected to determined URLs.

Assume that,

Site objects were created for them. (using The “sites” framework)

site_1 : example.com
site_2 : contact.example.com
site_3 : blog.example.com
...

Then, Redirects are handling with The Redirects app.

Example Redirects Goals:

>>> redirect_1 = Redirect.objects.create(
...     site_id=1,
...     old_path='/contact-us/',
...     new_path='/contact/',
... )

>>> redirect_2 = Redirect.objects.create(
...     site_id=2,
...     old_path='/',
...     new_path='https://example.com/contact/',
... )

>>> redirect_3 = Redirect.objects.create(
...     site_id=3,
...     old_path='/first-blog/',
...     new_path='https://example.com/blog/first-blog/',
... )

My questions

- Can The sites framework and The redirects app be used this way with subdomains?

- If possible, how should subdomains be configured for this use case?

Note: Assume that there is no configuration related to subdomains in the project and that what is wanted to be done is prefer to done by Django side as much as possible.