Welcome to WebmasterWorld Guest from 23.20.221.93

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Giving a different file based on browser version (using .htaccess)?

I need to redirect IE users to a different file using .htaccess

     
8:13 pm on Oct 23, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 5, 2002
posts:23
votes: 0


Basically I want IE users to get a different CSS page than other browser users (and other browsers could be later added, naturally). This should be done via .htaccess. We currently have a JS thing up, but this is not ideal. Does anyone have any ideas?
8:19 pm on Oct 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 21, 2001
posts:2149
votes: 0


RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^.*MSIE.*$
RewriteRule /* [url.you.want.com...]

PERSONALLY though - I would use SSI - that way you wouldn't have to send people to aa different url.

[edited by: Chris_R at 8:21 pm (utc) on Oct. 23, 2002]

8:20 pm on Oct 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 21, 2001
posts:2149
votes: 0


I think -it was part of a larger project
8:32 pm on Oct 23, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 5, 2002
posts:23
votes: 0


Thanks - how would I specifiy which file to redirect from though?
(e.g. redirect requests to global.css to global-ie.css)
8:35 pm on Oct 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 21, 2001
posts:2149
votes: 0


Hmmm, don't know - you could do it like this:

original file:

example.com/css/one.css

and put the htacess only in the /css/ directory and forward to:

example.com/css/two.css

That is the cheating way - I don't know how to do the real way. It would be easier (I think) to use SSI for this reason as well.

8:58 pm on Oct 23, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 5, 2002
posts:23
votes: 0


I've got it, thanks - changed the last line to:
RewriteRule global.css$ global-ie.css