jQuerybeast
jQuerybeast

Reputation: 14490

Redirecting IE 6 and 7 users to a specific folder using .htaccess

I am using this rule into my .htaccess to redirect IE 6 and 7 users to a specific url:

RewriteCond %{HTTP_USER_AGENT} MSIE\ ([67])\. 
RewriteRule (.*) http://www.example.com/ie/$1 [R=301,L]

but it ends up that users get to a website:

www.example.com/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie/ie

and it keeps going on forever.

What I'm I doing wrong?

Upvotes: 1

Views: 376

Answers (1)

poncha
poncha

Reputation: 7866

See, [R=301,L] means it really redirects (with http status 301) to a new location, meaning the browser will come again into same location with ie/ added... and everything will happen again.

What you need to do is add another RewriteCond before the rule:

RewriteCond %{REQUEST_URI} !^/ie/

This way, if MSIE comes in to /ie/something uri, this request will not be rewritten...

Upvotes: 2

Related Questions