Adding The Vary HTTP Header In WordPress
I finally finished building a mobile site for Salsa Vida SF, which was definitely a learning experience. Since responsive design sucks I used dynamic serving for the mobile site (using the Any Mobile Theme Switcher plugin), and basically rebuilt the site from scratch, allowing me to completely re-optimize the site experience for mobile.
One of the things that Google recommends is adding the Vary HTTP header, which helps Google figure out that you serve different content based on the user-agent. This is something I’ve never had to do in all my years of web design, but luckily WordPress makes it super simple.
All you need to do is paste the following code into the funcions.php file of both your mobile and desktop theme:
It took me a while to find the code snippet, but I was finally able to add it here.
Anyway, hope this is helpful to you and should be enough to get your dynamically served mobile site up-and-running!