Domain module & redirects

Created on 8 August 2021, over 3 years ago
Updated 14 December 2023, about 1 year ago

I am using the domain module.
Only setup two domains (www.mysite.com & m.mysite.com).

All is working as expected and I have each domain on a separate theme.

If I visit www.mysite.com on a desktop it looks exactly like I want.
If I visit m.mysite.com on a phone it looks exactly like I want.

Problem/Motivation

If I visit m.mysite.com on a desktop, it displays it and if I visit www.mysite.com on a phone is displays it… and they should not.

Here is my question…
How can I use this module to redirect based on the device?

Since the domain module already switches the theme based on the url, i do not really need the twig commands from this module to hide any blocks or anything based on device.

Instead, how can I use an if twig statement provided by this module to redirect to another domain?

For example.
On www.mysite.com custom theme, add something like… if mobile, redirect to m.mysite.com.
And on m.mysite.com custom theme, add something like… if tablet or desktop, redirect to www.mysite.com

Is this possible?
If so, what would that twig code look like?

Thank you for your time.

💬 Support request
Status

Needs work

Version

3.0

Component

Code

Created by

🇺🇸United States jsidigital

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024