How to redirect depending on the device used ?

IlyesPoke

Banned - PM spamming.
Joined
Nov 25, 2017
Messages
305
Reaction score
41
Hi, everyone!
I will be more precise.
When someone clicks on my link and it is on the computer it is redirected on offer 1 and if it is on mobile that it is redirected on offer 2.
Like a geo script but here depending on the device.
 
It is done by a rewrite rule based on the user-agent within the configuration of your Webserver.
 
Not quite sure how you will be able to do it?
I would connect to my vps thru SSH and edit the conf files of my nginx-Webserver.
I would add something close to this:

server {
server_name domain.com;
listen 80;

#----- redirect to mobile check (starts) -----#
set $mobile_rewrite do_not_perform;

# this regex string is actually much longer to match more mobile devices
if ($http_user_agent ~* "|android|ip(ad|hone|od)|kindle") {
set $mobile_rewrite perform;
}

if ($mobile_rewrite = perform) {
rewrite ^ http://mobile.domain.com$request_uri? redirect;
break;
}
#----- redirect to mobile check (ends) -----#

include /etc/nginx/aa-common.conf;

}
 
And have you an idea on how combine geo script and device script?
 
Dreamweaver does have bunch of those responsive template which does this for you. You just pick what sort of grid layout you need and develop content on that. Dreamweaver created all those responsive parts which change depending device resolution.
 
So you have different languages and for each a own mobile site? To be honest sound more a problem of website design and not serverconfig. But In the config you could use both:
Step 1 check Geo DNS and step 2 check for useragent. Rewrite to country specific mobile or desktop url.
 
No it's an offer cpa who accept only desktop traffic so i will combine with a second offer who accept mobile traffics.
 
In my case, I have a domain and I would like to promote 2 cpa offers one that accepts only desktop traffic and another that accepts mobile traffic.
 
Back
Top