Forum Moderators: phranque
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([a-zA-Z0-9\-\_\,\(\)]+).htm$ http://www.example.com/celd/mobile/$1.html [NC]
RewriteRule ^([a-zA-Z0-9\-\_\,\(\)]+)/([a-zA-Z0-9\-\_\,\(\)]+).htm$ http://www.example.com/celd/mobile/$1-$2.html [NC]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|#opera mobile|palmos|webos" [NC]
[edited by: phranque at 1:46 pm (utc) on Jun 7, 2013]
[edit reason] exemplified hostname [/edit]
I just can't get this to work
([a-zA-Z0-9\-\_\,\(\)]+)/([a-zA-Z0-9\-\_\,\(\)]+)
What does your best effort look like? It seems as if you are at least 3/4 of the way there.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) [%1...] [R=301,L]
RewriteRule blah blah (unrelated redirect from VARx.login$1 into login.pl?$1 [L,NC]
RewriteRule blah blah (unrelated redirect as above)
RewriteRule blah blah (unrelated redirect as above)
RewriteRule blah blah (unrelated redirect as above)
HERE: RewriteRule ^(.*).htm$ cgi-bin/core/script.pl?$1 [L,NC]
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) [%1...] [R=301,L]
RewriteRule ^(.*).htm$ folder/print.pl?$1 [L,NC]
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|#opera mobile|palmos|webos" [NC]
RewriteRule ^(.*).htm$ print.pl?$1 [L,NC]
It seems that ^(.*).htm$ works too.
RewriteCond %{HTTP_HOST} ^www\.(.*)
googlebot-mobile|iemobile|iphone|ipod|#opera mobile
^(.*).htm$ works too. ... Sure, but much less efficiently.
RewriteCond %{HTTP_HOST} ^www\.(.*)
Do any non-mobile UAs contain the string "mobile"? If not, seems like you can do a lot of compressing here.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} !desktop
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|mobile|iphone|ipod|palmos|webos|wap|midp" [NC]
RewriteRule ^(.*)/(.*).htm$ mobile/$1-$2.html [L]