Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Redirect MSIE browse + ES and DE traffic


iliumx - 7:32 pm on May 27, 2011 (gmt 0)


Hello,

I've several times had help reading the webmasterworld.com posts, but this is my first post. I need help with something. Please help. I'm a amateur regarding htaccess, so please bear with me as I try to explain what I need done.

I want to redirect all versions of IE browsers from one page to another internal page (not 301 redirect), and also redirect all Spanish and German traffic/users to the same pages. I have 4 specific pages that I need to do this on.

* Regarding of IE users

I have figured out a working solution. The code for this is:

RewriteEngine On (is at the top of the htaccess file)

# Redirect all users that use the browser MSIE from one htm file to another
RewriteCond %{HTTP_USER_AGENT} .*MSIE.*
RewriteRule ^(PAGE1.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE2.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE3.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE4.htm)$ http://example.com/NEW.htm [R,NC,L]


At least this works on IE 8, but I have read somewhere that this (.*MSIE.*) should work the same for all IE browsers (4,5,6,7,8,9).

I'm curious if that code will still work when I also need to add some code that will redirect German and Spanish traffic to thous 4 pages too the NEW.htm as well?

In my research I've read about people talking about {HTTP_ACCEPT_LANGUAGE} and {HTTP:Accept-Language} and {HTTP_HOST} for doing this correctly. I think some one wrote that {HTTP:Accept-Language} is the best solution. And on another place I read that one should use both {HTTP:Accept-Language} and {HTTP_HOST}. But I'm not sure how to put this together.

I'm not sure if this is right (probably not), but this is how far I've come:

* Regarding {HTTP:Accept-Language}

# Redirect Spanish and German users
RewriteCond %{HTTP:Accept-Language} (de|es) [NC]
RewriteRule ^(PAGE1.htm)$ http://example.com/NEW.htm [R,L]
RewriteRule ^(PAGE2.htm)$ http://example.com/NEW.htm [R,L]
RewriteRule ^(PAGE3.htm)$ http://example.com/NEW.htm [R,L]
RewriteRule ^(PAGE4.htm)$ http://example.com/NEW.htm [R,L]

Or I could put in NC at the end (not sure why? Does NC mean chase sensitive?):

RewriteCond %{HTTP:Accept-Language} (de|es) [NC]
RewriteRule ^(PAGE1.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE2.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE3.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE4.htm)$ http://example.com/NEW.htm [R,NC,L]


* Regarding {HTTP_HOST}

# Not really sure what this is for
RewriteCond %{HTTP_HOST} (de|es)
RewriteRule ^(PAGE1.htm)$ http://example.com/NEW.htm [R,L]
RewriteRule ^(PAGE2.htm)$ http://example.com/NEW.htm [R,L]
RewriteRule ^(PAGE3.htm)$ http://example.com/NEW.htm [R,L]
RewriteRule ^(PAGE4.htm)$ http://example.com/NEW.htm [R,L]

Or should this one as well have the NC at the end?

RewriteRule ^(PAGE1.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE2.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE3.htm)$ http://example.com/NEW.htm [R,NC,L]
RewriteRule ^(PAGE4.htm)$ http://example.com/NEW.htm [R,NC,L]


So, I was hoping someone in here could help me put together a working solution for redirecting all MSIE browsers and also all German and Spanish users/traffic as described here.

Thanks.


Thread source:: http://www.webmasterworld.com/apache/4318766.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com