Welcome to WebmasterWorld Guest from 54.144.77.26

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

     

Dave2

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

10+ Year Member



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?

Chris_R

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

WebmasterWorld Senior Member 10+ Year Member



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]

Chris_R

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

WebmasterWorld Senior Member 10+ Year Member



I think -it was part of a larger project

Dave2

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

10+ Year Member



Thanks - how would I specifiy which file to redirect from though?
(e.g. redirect requests to global.css to global-ie.css)

Chris_R

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

WebmasterWorld Senior Member 10+ Year Member



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.

Dave2

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

10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month