: .htacess mobile redirect stopped working My .htaccess mobile redirect code used to work. Now it stopped working. Does anyone know why? Here's the code: rewritecond %{HTTP_HOST} ^www.anumberoneanimalandpestcontrol.com$
My .htaccess mobile redirect code used to work. Now it stopped working. Does anyone know why?
Here's the code:
rewritecond %{HTTP_HOST} ^www.anumberoneanimalandpestcontrol.com$ [OR]
rewritecond %{HTTP_HOST} ^anumberoneanimalandpestcontrol.com$
rewritecond %{HTTP:x-wap-profile} !^$ [OR]
rewritecond %{HTTPS:Profile} !^$ [OR]
RewriteCond %{QUERY_STRING} !^desktop
# if the browser accepts these mime-types, it's definitely mobile, or pretending to be
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
# a bunch of user agent tests
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up.browser|up.link|audiovox"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone/|wap1.|wap2.|iPhone|android"[NC]
rewriterule ^$ anumberoneanimalandpestcontrol.com/pest-control-baltimore-mobile.html[R=301,L]
More posts by @Pierce454
1 Comments
Sorted by latest first Latest Oldest Best
I'd remove at least lines 3 through 7 because you're trying to detect very old phones with very small screens, and most mobile phones support standard HTML.
As for your rewrite rule, change:
rewriterule ^$ anumberoneanimalandpestcontrol.com/pest-control-baltimore-mobile.html[R=301,L]
to:
RewriteRule ^$ anumberoneanimalandpestcontrol.com/pest-control-baltimore-mobile.html [R=301,L]
There always needs to be one space before the first square bracket when it starts a set of RewriteRule/RewriteCond parameters such as [R=301,L].
I would suggest ditching most of your code except for lines 1, 2, and the last line and in between line 2 and the last line, add all the RewriteCond's in the apache code that you download from following this URL:
detectmobilebrowsers.com/
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.