I’m trying to display a differently-formatted page to mobile browsers using mod_rewrite based on the user-agent.
If I use a rewrite condition based on the user-agent to show different content, should I also set a Vary: user-agent header? If so, how do I configure apache to do that?
Yes, you should set the
Varyheader. HTTP/1.1’s section 14.44 Vary spells it out quite clearly. Fortunately, mod_rewrite’sRewriteCondhelpfully states thatSo you should verify that your configuration sets the header properly, but it should Just Work.