Redirecting users to different page or site using mod_rewrite

OK, if you want to redirect user to a different page or even a site, you can easily do it using mod_rewrite rule set:

RewriteCond %{HTTP_USER_AGENT} “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)” [NC]
RewriteRule ^(.*) http://yoursite.com/page.html [R=301,L]

Will redirect all users with Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) to http://yoursite.com/page.html


Leave a Reply