Skip to content

Instantly share code, notes, and snippets.

@Amitesh
Forked from aarongustafson/.htaccess
Created December 9, 2011 12:53
Show Gist options
  • Save Amitesh/1451423 to your computer and use it in GitHub Desktop.
Save Amitesh/1451423 to your computer and use it in GitHub Desktop.
An example of how Costco could redirect mobile requests properly
# setup
RewriteEngine on
RewriteBase /
# product redirection based on iPhone and product request
# note: the user agent check is contrived, you should have
# a much more robust checker
RewriteCond %{HTTP_USER_AGENT} iPhone
RewriteCond %{QUERY_STRING} Prodid=(\d+)
RewriteRule ^Browse\/Product\.aspx http://m.costco.com/costco/product/productDirectDetail.do?itemId=%1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment