homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

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)

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)

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)

I think -it was part of a larger project


 8:32 pm on Oct 23, 2002 (gmt 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)

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

original file:


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


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)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved