Skip to content Skip to sidebar Skip to footer

Htaccess Mobile Redirect For Specific Url

I have a created a duplicate m.website.com that have mobile friendly contents in them. However there are still some desktop page that I did not create a mobile version for it and I

Solution 1:

Try this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC,OR]
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 ^page1\.htm$ http://m.website.com%{REQUEST_URI} [L,R=302,NC]

Solution 2:

You should be able to do it like this:

RedirectMatch 301 ^/contact\.php$ /contact-mobile.php

Just set up a redirect for each specific page you want redirected to a mobile version.


Post a Comment for "Htaccess Mobile Redirect For Specific Url"