1

You know; Google suggest us to use Vary Tag at our diynamic content mobile pages.

please check the link: https://developers.google.com/webmasters/mobile-sites/mobile-seo/configurations/dynamic-serving

I couldnt understand how to use this tag. Do you have any idea where will i put it?

and how will we calculate Content-Length?

and how to customize this part 'GET /page-1 HTTP/1.1'?

is this a meta-tag(<>)? or just copy paste these lines to all our mobile pages?

HTTP/1.1 200 OK
Content-Type: text/html
Vary: User-Agent
Content-Length: 5710

Could you give an example of usage this Vary Code; in example.php for example.. where wil i put it; before tag; instead of tag?

<html> HTTP/1.1 200 OK Content-Type: text/html Vary: User-Agent Content-Length: 5710 <body> </body> </html> etc..

4
  • This is server response header stuff and not HTML stuff. The page you linked to was terrible. Here are some links: searchengineland.com/… stackoverflow.com/questions/1975416/… and w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44 There is little out there on this. Essentially, (if I read things right) the vary tag (not HTML) is for sites that are mobile only and is a setting within the web server itself.
    – closetnoc
    Commented Jan 15, 2015 at 0:34
  • is that mean, i dont need to do anyting? (if its auto creating by server.. my site has diynamic content mobile version )
    – deniz
    Commented Jan 15, 2015 at 0:52
  • I don't know if you do or not. It depends upon your environment. If you are using responsive design, then "No." You do not have to make this change. If you have a mobile site, then it is an option to study whether you make a change to your mobile site configuration or not. It appears to be primarily for caching. If you are worried about whether or not to make this change, I would say do not worry about it today but study it. It is a technical study that will take time to understand. Perhaps someone will have a good answer for you.
    – closetnoc
    Commented Jan 15, 2015 at 0:57
  • thank you so much closetnoc.. i'm going to wait; as you said too 'its not a urgent problem' (my site is changing its view by php; i mean, its neither responsive nor mobile site; it calls dynamic content)
    – deniz
    Commented Jan 15, 2015 at 1:36

1 Answer 1

1

What you're looking for is setting a header value for Vary.

The following PHP example will add a header value for:

Vary: Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2

<?php
$httpRequest->setHeaders(array('Vary' => 'Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2'));
?> 

You will want to use PHP's $_SERVER['HTTP_USER_AGENT']; to detect the user-agent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.