Skip to content

Instantly share code, notes, and snippets.

@cesardraw2
Last active August 29, 2015 14:15
Show Gist options
  • Save cesardraw2/75086179e16044430be6 to your computer and use it in GitHub Desktop.
Save cesardraw2/75086179e16044430be6 to your computer and use it in GitHub Desktop.
Como Redirecionar uma URL de acordo com o Browser
# As vezes precisamos fazer redirects específicos de acordo com o browser
# Por exemplo: http://cesardraw.com.br/babu
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Opera
RewriteRule ^babu$ /babu_opera [NC,L]
RewriteCond %{HTTP_USER_AGENT} MSIE
RewriteRule ^babu$ /babu_ie [NC,L]
RewriteCond %{HTTP_USER_AGENT} Chrome
RewriteRule ^babu$ /babu_chrome [NC,L]
RewriteCond %{HTTP_USER_AGENT} Safari
RewriteRule ^babu$ /babu_safari [NC,L]
RewriteCond %{HTTP_USER_AGENT} Firefox
RewriteRule ^babu$ /babu_firefox [NC,L]
# Se o browser não atender nenhuma das condições acima
RewriteRule ^babu$ /babu_default [L]
</ifModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment