.htaccess - Redirecting http urls to https -
there many example of making http
redirects https
.
options +followsymlinks rewriteengine on rewritebase / rewritecond %{server_port} !^443$ rewritecond %{https} off rewriterule ^(.*)$ https://www.example.com/$1 [r=301,l]
however, redirect urls coming web browsers. many functions being used in api calls mobile applications, hence can't use above code redirects urls https , apis calls make mobile apps crash.
how can modify above code, redirect urls thast coming web browser?
to detect web browser again mobile browser need check against http_accept
variable.
options +followsymlinks rewriteengine on rewritebase / rewritecond %{http_accept} !(text/vnd\.wap\.wml|application/vnd\.wap\.xhtml\+xml) [nc] rewritecond %{server_port} !^443$ rewritecond %{https} off rewriterule ^ https://%{http_host}%{request_uri} [r=301,l,ne]
Comments
Post a Comment