Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>RewriteEngine on # Check if this is the desktop to mobile query string RewriteCond %{QUERY_STRING} (^|&amp;)m=1(&amp;|$) # Set a cookie, and skip the next 2 rules RewriteRule ^ - [CO=mredir:1:%{HTTP_HOST},S=2] # Check if this is the mobile to desktop query string RewriteCond %{QUERY_STRING} (^|&amp;)m=0(&amp;|$) # Set a cookie, and skip the next rule RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] # Check if we're not already on the mobile site RewriteCond %{HTTP_HOST} !^m\. # Can not read and write cookie in same request, must duplicate condition RewriteCond %{QUERY_STRING} !(^|&amp;)m=0(&amp;|$) # Check to make sure we haven't set the cookie before RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC] RewriteRule ^(.*)$ http://m.website.com/ [L,R=302] # 1.) Check if on desktop site and having www., if not redirect to www.website.com RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} !^m\. [NC] RewriteRule ^(.*)$ http://www.website.com$1 [R=301,L] </code></pre> <p>2.) this cannot be done with mod_rewrite except "/chairs" is an existing file (and I guess it's not). So I would check it with your desired scripting language - e.g. in php:</p> <pre><code>if (!pageexists($_GET['page']) &amp;&amp; $_SERVER['HTTP_HOST'] == 'm.website.com') header("Location: http://m.website.com/"); </code></pre> <p>where pageexists() is a function you define to check if there is content for this page in mobile version.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload