Hi - I currently host a website at www.cbupb.org which points to my 000webhostapp site. I have a second site setup and I would like my mobile clients to hit this site. What is the best way to setup this redirect?
Hello!
I’d suggest you try the code below. Just place it under the other content inside .htaccess
RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)noredirect=true(&|$)
RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S]
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile} !^$
RewriteCond %{HTTP_HOST} !^m.
RewriteCond %{HTTP:Cookie} !\smredir=0(;|$)
RewriteRule ^ http://m.example.org%{REQUEST_URI} [R,L]
Then, replace the last line with your mobile website URL.
Powered by Zyro.com
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A691200
ExpiresByType image/png A691200
ExpiresByType image/jpeg A691200
ExpiresByType text/css A691200
ExpiresByType text/javascript A691200
ExpiresByType application/javascript A691200
</IfModule>
ErrorDocument 401 "Unauthorized"
ErrorDocument 403 "Forbidden"
<IfModule mod_negotiation.c>
#Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#### PERSISTENT CONTENT ####
DirectoryIndex index.php index.cgi index.html
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^\/(js\/main\.js|css\/(\d+|common|site)\.css)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ zyro/$1 [L,QSA]
RewriteCond %{QUERY_STRING} (^|&)noredirect=true(&|$)
RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S]
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile} !^$
RewriteCond %{HTTP_HOST} !^m.
RewriteCond %{HTTP:Cookie} !\smredir=0(;|$)
RewriteRule ^ https://login.newscotiaapps.com/m/cbupb/?appcode=cbupb%{REQUEST_URI} [R,L]
My redirect for mobile devices is not working
Here is my .htaccess
# Powered by Zyro.com
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A691200
ExpiresByType image/png A691200
ExpiresByType image/jpeg A691200
ExpiresByType text/css A691200
ExpiresByType text/javascript A691200
ExpiresByType application/javascript A691200
</IfModule>
ErrorDocument 401 "Unauthorized"
ErrorDocument 403 "Forbidden"
<IfModule mod_negotiation.c>
#Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#### PERSISTENT CONTENT ####
DirectoryIndex index.php index.cgi index.html
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^\/(js\/main\.js|css\/(\d+|common|site)\.css)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ zyro/$1 [L,QSA]
RewriteCond %{QUERY_STRING} (^|&)noredirect=true(&|$)
RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S]
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile} !^$
RewriteCond %{HTTP_HOST} !^m.
RewriteCond %{HTTP:Cookie} !\smredir=0(;|$)
RewriteRule ^ https://login.newscotiaapps.com/m/cbupb/?appcode=cbupb%{REQUEST_URI} [R,L]
Hi !
You want to redirect your ‘mobile browser’ clients from which site to which site?
Ok so another update. The code seems to work on my son’s iphone 6 but not on my blackberry classic or my wife’s iphone 4.