Adding a mobile subdomain

I want to make a mobile-friendly version of my site at the subdomain: mobile-mywebsite-com

How do I do this through Cloudflare?

I do not understand the Cloudflare help manual on this topic.

Where do I create the folder to put the subdomain files into? The root?

I thought to make Cloudflare redirect mobile-mywebsite-com to mywebsite-com/mobile
(replace hypens with dots, those are not actual websites, it is just for example)

Is that a good idea? If so how can I do that?

It seems like Cloudflare mobile direct only works with subdomains and not folders like /mobile/

I know what to do to make the site more mobile friendly, I just don’t know about the redirect/subdomain part.

RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

Would this work if I just put that in .htaccess and made a folder?

If you’d like to try out, I’d sugest you to check an option at CF dashboard if you navigate to the Speed → Optimization → scroll down to the bottom and you’ll see “Mobile Redirect” section. Therefrom, you can set it up if you want and have a sub-domain for a visitors coming from mobile phones.

Helpful article:

Just to add a note, sub-domain isn’t the same as a directory.

Possibly, could be achieved by using Transform Rules to detect the “mobile visitor” via some of the known Web browser user-agents for mobile.

Otherwise, maybe some idea wih Cloudflare Workers :thinking:

Nevertheless, Cloudflare APO for WordPress, if you’re using WP, might work too:

The Cloudflare subdomain method is what I want to use.

But I do not know how to make a subdomain using Cloudflare.

You’d have to create it at your hosting provider interface, like cPanel or Plesk, etc.

Furthermore, you’d just have to add a new DNS record, for exmaple A mysub pointed to your web hosting / server IP.

Helpful tutorial with a step-by-step instructions how to add a new DNS record (for a sub-domain in your case):

Make sure you’re having a valid SSL certificate covering your sub-domain.
Sharing here the article for more information about the possible SSL issues with a sub-domain, if so:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.