Rewrite for mobile device

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 6
Joined: 01 Nov 2013, 02:21

Rewrite for mobile device

26 Oct 2016, 20:32

Hi,

I am using APE and have a URL rewrite code that is broken, which I am hoping you can help to fix.

I have a Wordpress installation that uses a plugin called WP Super Cache to create static html files. It creates a separate html file for desktop, mobile and https: index.html and index.html.gz for desktop and index-mobile.html and index-mobile.html.gz for mobile and index-https.html and index-https.html.gz for https.

The current code serves the index.html or index.html.gz regardless of device. What should I add/change to get it to serve the mobile version for mobile devices.

Code: Select all
# BEGIN WPSuperCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|iPhone|iPod|incognito|webmate|Android|dream|CUPCAKE|froyo|BlackBerry9500|BlackBerry9520|BlackBerry9530|BlackBerry9550|BlackBerry\ 9800|BlackBerry\ 9850|BlackBerry\ 9860|BlackBerry\ 9780|BlackBerry\ 9790|BlackBerry\ 9900|BlackBerry\ 9930|BlackBerry\ 9350|BlackBerry\ 9360|BlackBerry\ 9370|BlackBerry\ 9380|BlackBerry\ 9810|webOS|s8000|bada|IEMobile/7.0|Googlebot-Mobile|AdsBot-Google).* [NC]
RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} on
RewriteCond %{DOCUMENT_ROOT}/C:/wwwroot/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f
RewriteRule ^(.*) "/C:/wwwroot/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|iPhone|iPod|incognito|webmate|Android|dream|CUPCAKE|froyo|BlackBerry9500|BlackBerry9520|BlackBerry9530|BlackBerry9550|BlackBerry\ 9800|BlackBerry\ 9850|BlackBerry\ 9860|BlackBerry\ 9780|BlackBerry\ 9790|BlackBerry\ 9900|BlackBerry\ 9930|BlackBerry\ 9350|BlackBerry\ 9360|BlackBerry\ 9370|BlackBerry\ 9380|BlackBerry\ 9810|webOS|s8000|bada|IEMobile/7.0|Googlebot-Mobile|AdsBot-Google).* [NC]
RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/C:/wwwroot/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
RewriteRule ^(.*) "/C:/wwwroot/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|iPhone|iPod|incognito|webmate|Android|dream|CUPCAKE|froyo|BlackBerry9500|BlackBerry9520|BlackBerry9530|BlackBerry9550|BlackBerry\ 9800|BlackBerry\ 9850|BlackBerry\ 9860|BlackBerry\ 9780|BlackBerry\ 9790|BlackBerry\ 9900|BlackBerry\ 9930|BlackBerry\ 9350|BlackBerry\ 9360|BlackBerry\ 9370|BlackBerry\ 9380|BlackBerry\ 9810|webOS|s8000|bada|IEMobile/7.0|Googlebot-Mobile|AdsBot-Google).* [NC]
RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
RewriteCond %{HTTPS} on
RewriteCond %{DOCUMENT_ROOT}/C:/wwwroot/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f
RewriteRule ^(.*) "/C:/wwwroot/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|iPhone|iPod|incognito|webmate|Android|dream|CUPCAKE|froyo|BlackBerry9500|BlackBerry9520|BlackBerry9530|BlackBerry9550|BlackBerry\ 9800|BlackBerry\ 9850|BlackBerry\ 9860|BlackBerry\ 9780|BlackBerry\ 9790|BlackBerry\ 9900|BlackBerry\ 9930|BlackBerry\ 9350|BlackBerry\ 9360|BlackBerry\ 9370|BlackBerry\ 9380|BlackBerry\ 9810|webOS|s8000|bada|IEMobile/7.0|Googlebot-Mobile|AdsBot-Google).* [NC]
RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/C:/wwwroot/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
RewriteRule ^(.*) "/C:/wwwroot/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]
</IfModule>

# END WPSuperCache

# BEGIN supercache
<IfModule mod_mime.c>
  <FilesMatch "\.html\.gz$">
    ForceType text/html
    FileETag None
  </FilesMatch>
  AddEncoding gzip .gz
  AddType text/html .gz
</IfModule>
<IfModule mod_deflate.c>
  SetEnvIfNoCase Request_URI \.gz$ no-gzip
</IfModule>
<IfModule mod_headers.c>
  Header set Vary "Accept-Encoding, Cookie"
  Header set Cache-Control 'max-age=3, must-revalidate'
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html A3
</IfModule>
# END supercache


User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: Rewrite for mobile device

28 Oct 2016, 11:10

Hello.

I see some rules for non-mobile content in your config but there seem to be no rules for mobile clients. I suppose this "WP Super Cache" should provide some rules on it or there should be some documentation how to tune it for mobile clients.

User avatar
Posts: 1
Joined: 20 Jun 2017, 06:33

Re: Rewrite for mobile device

20 Jun 2017, 06:37

The script is perfectly all right. I just run it. It's working perfectly well for me. Instead of running hole script, You can try out a simple app from Vshare Market app store which is working like charm.
Thanks in advance.

User avatar
Posts: 1
Joined: 26 Jun 2017, 05:27

Re: Rewrite for mobile device

26 Jun 2017, 05:29

Just a smile and the rain is gone Can hardly believe it, yeah. There's an angel standing next to me. Reaching for my heart Just a smile and there's no way back .Can hardly believe it, yeah But there's an angel calling me. Reaching for my heart I know that I'll be okay now. This time, it's real I lay my love on you It's all I wanna do Every time I breathe I feel brand new You open up my heart Show me all your love and walk right through As I lay my love on you. fireboy and watergirl 4
dumb ways to die

User avatar
Posts: 1
Joined: 03 Aug 2017, 18:00

Re: Rewrite for mobile device

03 Aug 2017, 18:03

Our eyes will always be on torrents to download the movies, games, TV shows etc. to download the movies and shoes, we need a application for downloading torrents, there are many torrent software are available on the internet http://appforfree.net/utorrent-pro-apk/

User avatar
Posts: 1
Joined: 03 Aug 2017, 20:27

Re: Rewrite for mobile device

03 Aug 2017, 20:34

The latest and unique new born baby girl costumes are really great to wear. Disney character Halloween costumes for new born baby girl. Cinderella Halloween costumes for new born baby will give a great look.

Posts: 3
Joined: 09 Jun 2017, 04:57

Re: Rewrite for mobile device

14 Sep 2017, 03:20

Interesting article! Thank you for sharing them! I hope you will continue to have similar posts to share with everyone!

- - - Lily Oliver - - -
madalin stunt cars 2

User avatar
Posts: 1
Joined: 21 Sep 2017, 03:09

check cashing near me

21 Sep 2017, 03:11

Really endure in mind United States and that we can money your test terribly brief amount with a virtually low charge.
<a href="http://www.unitedcheckcashing.com/">check cashing near me</a>

User avatar
Posts: 1
Joined: 14 Oct 2017, 13:04

Re: Rewrite for mobile device

14 Oct 2017, 13:07

I guess you will love to download GarageBand Apk for Android for Android Smartphone! http://www.garagebandforandroid.com/2017/08/garageband-apk-download.html

User avatar
Posts: 1
Joined: 23 Nov 2017, 15:34

Re: Rewrite for mobile device

23 Nov 2017, 15:40

http://www.medicamentfrance.net/original-viagra-acheter-en-ligne-sans-ordonnance.html pour se procurer du sildenafil

User avatar
Posts: 1
Joined: 25 Nov 2017, 03:31

Re: Rewrite for mobile device

25 Nov 2017, 03:34

easy to finding us http://www.unitedcheckcashing.com as we are at your city or nearest places. Just remember us and we will cash your check very short period with a very low cost.
Code: Select all
check cashing

User avatar
Posts: 1
Joined: 25 Dec 2017, 19:40
Location: Ho Chi Minh, Viet Nam

Re: Rewrite for mobile device

25 Dec 2017, 19:53

i think you can trial change ssl to ss. Before i had a trouble the same. good luky!

User avatar
Posts: 5
Joined: 14 Sep 2017, 23:30

Re: Rewrite for mobile device

09 Jan 2018, 00:34

Your topic has a lot of useful information for myself. I visit regularly. Hope to have more quality items.
----------------------

User avatar
Posts: 1
Joined: 16 Jan 2018, 08:16
Location: United States

Re: Rewrite for mobile device

16 Jan 2018, 08:17

This is a nice and informative post

User avatar
Posts: 2
Joined: 22 Jan 2018, 06:04

Re: Rewrite for mobile device

22 Jan 2018, 06:06

very useful

User avatar
Posts: 2
Joined: 22 Jan 2018, 06:04

Re: Rewrite for mobile device

22 Jan 2018, 06:08

very useful

User avatar
Posts: 1
Joined: 14 Mar 2018, 08:49

Aolmaillogin

15 Mar 2018, 04:47

With the effect of digitalization, there are a lot of companies in existence now, but back in the days of 1990s, there were only a countable number of companies which used to rule the internet world. American Online or is one of them. The name itself makes many nostalgic whenever someone lived in that period of time remembers AOL. This was the reputation of <a href="https://mailsignins.com/www-aolmail-com-aol-login-signup-registration/">aolmail.com</a>

User avatar
Posts: 1
Joined: 17 Mar 2018, 08:58
Location: United States

Anker Products

17 Mar 2018, 09:14

Today mobile is one of the most useful devices by people. https://www.promoocodes.com/coupons/anker/ is the place where you can find power banks and chargers for your mobiles and laptops. Thank you for this great post.

User avatar
Posts: 1
Joined: 19 Mar 2018, 07:21

Re: Rewrite for mobile device

19 Mar 2018, 07:23

Click here for more information
http://tuttut.org/

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 30 guests