Im trying to redirect the mobile request to different url on my website say abcd.com on the basis of HTTP_USER_AGENT in apache 2.2
I have written the following script in http.conf file in apache conf folder,
<IfModule mod_rewrite.so>RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^$ https://abcd.com/userMaster/rl_login [L,R=302]
</IfModule>
pls suggest if im doing anything wrong
Thanks
Praveen
I suggest you skip trying to do it via your http.conf
file and rather do it with an .htaccess
file located in the websites root folder.
To achieve this, simply create a text file on your local computer, add the following code:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte" [NC]
RewriteRule ^$ https://abcd.com/userMaster/rl_login [L,R=302]
And save it as a .htaccess
file. Then, log into your server with your FTP-client and upload that .htaccess
file to the root directory of the website.
If you are able to upload files using FTP, then you must be able to add a .htaccess
file to the server.