Jim,
If I have
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
in my header instead of just
<style type="text/css">
Can that disrupt the page being found or counts by awstats and google analytics?
Thanks,
Roger

Jim,
With this code
<meta name="Expires"
content="<? echo gmdate (‘D, d M Y H:i:s’, time()+00*05*00)?>">
It appears that D, d, M, Y, H, i and s are the format variables for the values to the right, 00 05 and 00.
That capital D is for the text of the Day (ie "Tuesday"). If this PHP code isn’t being used to place a date on a web page, it makes me wonder if browsers will create an expiration date using D. If I want to leave the hours parameters (00) open to be able to easily make changes in the future, same for minutes (08), and I guess seconds (00), will this code do the same thing:
<meta name="Expires"
content="<? echo gmdate (‘H:i:s’, time()+00*05*00)?>"> ?
Thanks Jim,
Roger
W3C says:
Webmasters must specify the style sheet language of style information associated with an HTML document and should use the META element to set the default style sheet language for a document. For example, to set the default to CSS, authors should put the following declaration in the HEAD of their documents:
<META http-equiv="Content-Style-Type" content="text/css">
and that:
a) If any META declarations specify the "Content-Style-Type", the last one in the character stream determines the default style sheet language.
b) Otherwise, if any HTTP headers specify the "Content-Style-Type", the last one in the character stream determines the default style sheet language.
c) Otherwise, the default style sheet language is "text/css".
So, no, it will not disrupt the page. I’m assuming you have some styles after the <style type="text/css">, right? I’m don’t thing you need that first one.
I put my styles in a file, then call the file. It makes your site load faster!
Here is an example:
<link href="/style.css" rel="stylesheet" type="text/css" />
Regards,
Jim.
Jim,
One of two pages I have on the server has CSS and it seems it’s not getting counted by both awstats and G.analytics; was getting only about 1/4 the counts (maybe actual traffic) and then nbothing at all. I took the meta tag out and made a number of text changes, and reloaded it. The counting seems to have started back up. It might have been the Tidy function inside the EvrSoft web editor I was using. Do you have a recommendation for a great web editor for under $60 bucks. Right now I use NVU and then Tidy it with Ultra Edit.
Don’t think I’ll move the CSS code to a separate file since it’s only like 15 KB.
Thanks,
Roger
Hi Roger,
Moving the css to a separate file can really help – yes, it’s only 15kb, but you are forgetting the multiplier which is the number of pages you have. So, if you have 100 pages, then your are looking at 1.46 megabytes total.
When the bots visits, they will look at your site without style sheets provided you point to a separate file (they will not load them). If however, your styles are inside your page, then the bot grabs the page and styles (extra load).
As for an excellent modern website editor – I don’t have a clue. I use HomeSite5 and utraedit or notepad ++. I am sure there is something out there to do much of the work I do by hand, but I just don’t have the time to learn something new right now. — I know, if I make the time now, I’ll save more time later — but….
Regards,
Jim.
Jim,
Can’t believe it’s September already. This global warming thing is terrible, but surpisingly Syracuse’s weather has gotten a lot sunnier. Every weekend was sunny this summer so far. In the past we would get maybe two or three sunny weekends. It’s been bad for apple trees though – way to dry.
Anyway, I’ll have to put the CSS in a separate file for your reasons and I’m desperate to get it down to 40kb. I spent several hours getting from 64 down to 55kb. Isn’t it true that pages should be about 40 or fewer kb. Isn’t there really a threshohld there or is that an arbitrary point (like 100yard dash – why not a 99 or 101 yard dash?).
So in putting the CSS in a separate file, I upload a wordpad file with just the CSS no opening/closing stuff no html, etc., just the CSS I have on my page. I upload somename.css to the same area I upload all my other pages, then where the CSS began in my page I type in <link rel="stylesheet" type="text/css"
href="somename.css">
w3schools.com/css/css_howto.asp
Roger
Jim, I think my page on preventing and reversing heart disease is getting to be one of the most informative and practical on the internet in only 40kb.
Jim,
When I took the CSS code out of the web page (and put it into a separate css file) it save my site only 1.2KB. The new css file made by changing a wordpad (.doc) to .css was 12kb. I used the ultra edit editor to put the css code into a file and it was only 1.2 kb.
Not only is it too dry for apple trees, at least my apple trees, I saw a water table for the whole country last year and all the land west of the Mississippi river was either very dry or drought, and east of the Mississippi was normal. I can’t imagine what thoat water table looks like now. NPR had an interview with someone about the Dust Bowl of the 30s – It might happen again.
Roger
Jim,
You were saying that when bots visit my site, they will look at my site without style sheets provided you point to a separate file (they will not load them). If however, your styles are inside your page, then the bots grab the page and styles (extra load). What about all these meta tags I have – do they get in the way of bots, which ones should I remove?
<meta name="Rating" content="General">
<meta name="distribution" content="global">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta name="robots" content="index,follow">
<meta name="audience" content="all">
<meta name="revisit-after" content="5 days">
<meta name="MSSMARTTAGSPREVENTPARSING" content="True">
<meta name="copyright" content=
"Copyright 2007, All Rights Reserved">
Thanks,
Roger
Hi Roger,
They won’t get in the way. I’m not exactly sure which ones you should and should not use, but I only worry about the Rating and Description and it works fine for me. Some search engines may look for certain meta tags while others may look for different ones:
One thing of concern is the no-cache. There is a lot of cloaking going on these days and no-cache is in the heart of it. Cloaking is a black-hat technique at getting your site to rank well by delivering content that is different for humans than it is for search engines. There are cases where this happens and it is not intended to be black-hat, but doing so may be risky.
Example: Your site might contain 100 words for human visitors, but when your server detects a search engine bot, it kicks out 100,000 words designed to make the search engine believe that you have a lot of content about a subject (and rank you better).
Many sites doing this use no-cache to pervent people from viewing the cache of the search engines. Go to Google and type in the full website address of a page from your favorite site and google will show you two options, the site url and the site’s cache. Visiting each should show the same results; if the results are different (more content, etc), then people would notice and report them to the search engine.
So, they use no-cache and when google lists your url, there will not be an option to view the cache, only the url.
So, I stay away from that – but that’s me, it’s still used by many sites.
Regards,
Jim.
Jim,
I have the <meta http-equiv="pragma" content="no-cache"> tag in there so that when someone visits a page on my site they don’t get a version stored in their computer from 3 months ago. I make changes all the time. So I would think no-cashe would be how you prevent stale content.
I’m having trouble understanding what the risk is. Is it that Google will think you’re trying to cloak when using the no cashe meta tag, or that people might report to google that they can’t see what’s in Google’s cashe for my site and so I maybe cloaking? If so how do I prevent a user’s computer from casheing my pages without the no cashe tag?
Thanks,
Roger
I’m not saying that Google will think you are cloaking, but it is often used by people who cloak their sites. When Google visits my sites, I want them clean and so I just stay away from the no-cache.
So, how do you tell visitor’s browsers that your site’s content has changed?
Use the <meta name="Expires" content="date"> instead which will cause your page to be reloaded from the website after the given date (even if it is stored in the user’s cache).
Here is an example:
<meta name="expires" CONTENT="Thu, 06 Sep 2007 19:29:16"> which says that the document will expire on September 6, 2007 at 7:29:16 PM.
So, how do you set your pages to expire in a day? That’s where php comes into play.
Simply add this code to your page in the meta section.
<meta name="Expires" content="<?echo gmdate(‘D, d M Y H:i:s’, time()+24*60*60)?>">
Your page will have to have a php extension or htaccess file telling it that htm executes php, etc…
Regards,
Jim.
Jim,
I read on mnot.net/cache_docs/#IMP-SERVER that if your server has apache mod_expires and mod_headers modules turned on, You can use the HTAccess file to control cache.
"Here
Jim,
Have you read about this method for IE cache?
<html>
<head>
<meta http-equiv="PRAGMA" content="NO-CACHE">
<meta http-equiv="EXPIRES" content="-1">
</head>
<body>
AND
</body>
<head>
<meta http-equiv="PRAGMA" content="NO-CACHE">
<meta http-equiv="EXPIRES" content="-1">
</head>
zann-marketing.com/developer/20051018/stop-browser-caching-using-meta-tags.html
Yes, and they will work.
Regards,
Jim.
Jim,
I remeber when you showed where in my HTAcess file error page information goes. So HTAcess requires a certain sequence. Where in the HTAcess file would I put
### activate mod_expires
ExpiresActive On
### Expire .gif’s 1 month from when they’re accessed
ExpiresByType image/gif A2592008
### Expire everything else 1 day from when it’s last modified
### (this uses the Alternative syntax)
ExpiresDefault "modification plus 1 day"
### Apply a Cache-Control header to index.html
<Files index.html>
Header append Cache-Control "public, must-revalidate"
</Files>
in order to stop cashing of my page?
Can I change "/gif" to "/jpeg" to have their computers cache my jpegs? (Don’t have any gifs.)
Thanks,
Roger
Jim,
My webhost wrote me saying they have Apache 1.3.37 and it doesn’t have mod_expire but does have headers.
I looked at my HTAcess file and I have the error page codes first, then redirect to www address code, then there’s "#FrontPage" and then all original HTAcess code following. Can I put
<Files index.html>
Header append Cache-Control "public, must-revalidate"
</Files>
anywhere in that beginning part, like after the redirect, to force browsers to not cache my site?
Do You think
<meta name="Expires" content="<?echo gmdate(‘D, d M Y H:i:s’, time()+24*60*60)?>">
in the web page header with the php htaccess code would be better in some way.
(or maybe use both?)
Thanks,
Roger
Hi Roger,
In your example, you’ll be making the mod for only the index file. Take a look at the example below.
ExpiresActive On
ExpiresByType image/jpg "modification plus 2 days 2 hours" #Expire jpg’s 50 hours after last mod date.
ExpiresByType text/html "access plus 1 day" #Expire html documents in 1 day from hit
ExpiresDefault "modification plus 1 day" #Expire everything else 1 day from last mod!
<Files index.html> #Apply a Cache-Control header to just index.html
Header append Cache-Control "public, must-revalidate"
</Files>
You can see a number of options available to you for setting the expire date. A common mistake many make is setting the expire date using the ‘modification’ tag. If you last modified the file on 1/1/2007, then the expire date would be set from that point, and in our case, if it was 1 day, it would be set to the past.
The access date is the last time the visitor accessed the document, so this is what you want to use.
The command can get a little crazy, such as "access plus 1 year 2 months 3 weeks 4 days 5 hours 20 seconds" and as you can see, you can use years, months, weeks, days, hours, minutes, seconds to set the expire date.
So, for you, I would use this at the top of my htaccess file (top works for me).
ExpiresActive On
ExpiresByType text/html "access plus 1 day"
That should expire your html documents a day from the time the user hit your page.
Also, here is a list of HTTP status that may be returned (you probably won’t need them, but here they are anyway):
* 200: request completed (OK)
* 201: object created, reason = new URI
* 202: async completion (TBS)
* 203: partial completion
* 204: no info to return
* 205: request completed, but clear form
* 206: partial GET furfilled
* 300: server couldn’t decide what to return
* 301: object permanently moved
* 302: object temporarily moved
* 303: redirection w/ new access method
* 304: if-modified-since was not modified
* 305: redirection to proxy, location header specifies proxy to use
* 307: HTTP/1.1: keep same verb
* 400: invalid syntax
* 401: access denied
* 402: payment required
* 403: request forbidden
* 404: object not found
* 405: method is not allowed
* 406: no response acceptable to client found
* 407: proxy authentication required
* 408: server timed out waiting for request
* 409: user should resubmit with more info
* 410: the resource is no longer available
* 411: the server refused to accept request w/o a length
* 412: precondition given in request failed
* 413: request entity was too large
* 414: request URI too long
* 415: unsupported media type
* 500: internal server error
* 501: required not supported
* 502: error response received from gateway
* 503: temporarily overloaded
* 504: timed out waiting for gateway
* 505: HTTP version not supported
Also keep in mind that when using the ‘modification’ setting, the Expires header does not apply to documents created on the fly as the computer can not calculate the last modified date – yup, it can’t do everything
Hope that helps!
Best regards,
Jim.
Jim,
Is ExpiresActive On unrelated to mod_expires, since my host said they don’t have mod_expire on their server?
Thanks,
Roger
is it that php doesn’t need the mod_expire. I guess that
<meta name="Expires" content="<?echo gmdate(‘D, d M Y H:i:s’, time()+24*60*60)?>">
in the web page header would be used with the php htaccess code.
Roger
Jim,
So it looks like if your web host doesn’t have Apache with the mod-expires function, you can’t stop someone’s browser from caching your site with mod-expires and ExpiresAcitive On.
But you can use the PHP method to stop the caching of your site, the limitation is that the PHP method doesn’t allow caching of images.
The PHP method is to put AddType application/x-httpd-php .html in the top of your HTAccess file, then in the head of each page that you don’t want visitors’ browsers to cache you put <meta name="expires" CONTENT="Thu, 06 Sep 2007 19:29:16"> (or any date that has already passed).
Is this right?
Thanks,
Roger
You’re on the right track Roger; however, you don’t want to expire the document to a date passed, but rather a date in the future close to the current date that the user visits the page.
The addtype is just so that we can make your html pages run php code.
Then, we add meta expires with a little php code to figure our the date the second the user views the page and then add a little time to it.
I know there is a delay in my responses – I do the best I can
So the PHP way is 1) put AddType application/x-httpd-php .html in the top of your HTAccess file (to tell your webhost server to recognize PHP in HTML pages), then
2) put <meta name="Expires" content="<?echo gmdate (‘D, d M Y H:i:s’, time()+24*60*60)?>"> in the head of each page so when a browser downaloads the page (say today 9/24) the browser will use 9/25 as an expiration date. If on 11/25 the browser is asked to download the page again, it will see the 9/25 expiration date it saved, understand that 9/25 has pased, and go to the internet for a fresh copy and display the fresh copy, and calculate a new expiration date, 11/26.
((And you could set the expiration to anytime in the future like <meta name="Expires" content="<?echo gmdate (‘D, d M Y H:i:s’, time()+8*00*00)?>"> for 8 hours ahead.))
((And with the above ExpiresActive On ExpiresByType text/html "access plus 1 day" is not needed becuase it’s part of mods not PHP.))
It sounds like you can’t just put in an old date as a expiration date for some technical reason. Also, it sounds like the added anti-caching code won’t help pages that were cahed without the anti-caching code.
How does this sound?
Thanks Jim,
Roger
You are correct Roger – The reason for not hard coding an expired date is somewhere in the back of my mind. I read somewhere that this was a problem (something like that) and that this is the preferred way of doing it.
Best regards,
Jim.
Jim,
I got AddType application/x-httpd-php .html .php .htm onto my HTAcess file and my webost (Bluehost) wanted AddHandler application/x-httpd-php .html .php .htm on the next line after. I tried a php time stamp and it worked fine.
Checking the expire function is getting tricky. It seems no matter what settings I try in Firefox (Tools, Options, cache, settings) , Firefox always goes to the internet for a fresh copy. I have the expires code on my /cone.html page. What’s an easy way to check the no caching function?
Thanks,
Roger
Jim,
Jim the Expires line
<meta name="Expires" content="<?echo gmdate (‘D, d M Y H:i:s’, time()+00*05*00)?>">
says that the page expires 5 minutes from now – right? Can you forsee any problems with a five minute expiration time?
Thanks,
Roger
Hi Roger,
I can’t think of one right now – it’s the expire in the past that is a problem, so you should be all set with expiring 5 minutes from now.
Best regards,
Jim.
I think that’s what I’ll do, five minutes.
Thanks,
Roger
Jim,
When you get some free time, The expires line
<meta name="Expires" content="<?echo gmdate (‘D, d M Y H:i:s’, time()+00*05*00)?>">
works great except I don’t understand the results.
(I changed the expire time to 8 minutes.)
When I brought up the first page I used it on and went to page source it showed an expire time of
<meta name="Expires" content="Tue, 09 Oct 2007 17:10:50">
yet it was 1:12 (13:12) on the East Coast.
I thought Zurich time was 5 hours off? Any way, I would think the expire time would be close to 13:20, that would make my math 3:50 off. Where did the 3 come from, and since time zones are in 1 hour increments, where does the 50 come from?
Thanks,
Roger
Jim,
Today I compared the View Source time to my computer clock and the difference was 1:52.
So what is the East coast UTC+ time? If I wanted an expiration of 8 minutes in the future would it be UTC+X+08(i)?
Thanks,
Roger
Hi Roger,
You can place that code in a test page and then view the source to see the output.
<META HTTP-EQUIV="expires" CONTENT="Feb, 15 Aug 2008 12:12:27 GMT">
This indicates that the document containing this META tag will expire at this date. If the document is requested after this date, the browser should load a new copy from the server, instead of using the copy in its cache.Best regards,
Jim.
Jim,
Sorry to drive you crazy on this:
1) On browsers – If the browser sees in its cache an expiration date for a site that is older than the current date, it will go to the net for an update of the site. The sooner an expiration date used the sooner (the more frequently) the browser will see that the expiration date it has for a site is older than the current date and therefore will go to the internet to the site for the latest copy.
2)On bobots, robots, spiders and other critters – If a bot sees you have an expiration date on a site that is older than the current date, chances are it won’t come back to see if you added anything new to the site. If you have an expiration date in the near future (ie a day, 8 hours, 5 minutes) bots will comeback on or after that near future expiration date for the new information. The sooner the near future expiration date the more likely a bot will visit your site for more information.
3) Since bots can’t record that much information in one visit anyway, if you have a site with 1000s of words and you make additions or changes every other day, then the expiration date should be how many minutes, hours, or days in the future?
Thanks,
Roger
It will come back, but when we don’t know – depends on the bot. You are giving the bot guidelines, but it’s up to the critters to decide if they will honor them.
Right.
Yes, but bots like Google will have a base time for revisiting. They may have a base time of one day and ignore your revisit of one hour setting. Imagine the bot listened to everyone and everyone had a revisit of 5 minutes, the bot would implode and we can only imagine what the results of that would be
3) This all depends on the content – if it changes often, then place the appropriate expiration time and let Google and others figure out how to handle it.
I have a theory that Google looks at a page and comes up with a checksum (can’t think of the exact term right now) and grabs some key information. During the spider process, it compares it’s checksum to that of the web page and when different, it knows a change has occurred and flags it for further examination.
If the page’s content has changed, then you’re ranking may be moved way down for a time until Google can figure out what really changed. If you add content to the existing unchanged content, such as a comment to a post or page, (post stays the same, comment is new) then you’re OK. It all depends on your site (blog, static website, etc) and Google has a flag for that as well. For example, Google may know your site is a blog and that your posts / pages may change content from time to time, but that your achieved pages will never change, and if they do, then something must be up.
People link to a site’s content because they are talking about a related topic. If the content has changed in a significant way, then that link may no longer be accurate.
No one knows for sure how Google programs there bots and I’ve not heard back from anyone on my request to review they code
Regards,
Jim.
Definitely on the mark with this Jim:
As I make changes to existing content from new techniques and lessons learned, I end up touching a significant number of product pages and I always see a drop in rank until Google figures out what has changed. The rebound is usually good when it happens, so I thank you for that!
Loretta
Try:
<meta name="Expires" content="<?echo date (‘D, d M Y H:i:s’, time()+60*5)?>">
60 seconds x 5 minutes.
Here are the values:
Day:
d…Day of the month, 2 digits with leading zeros
D…A textual representation of a day, three letters
j…Day of the month without leading zeros
l…(lowercase ‘L’)…A full textual representation of the day of the week
N…ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)
S…English ordinal suffix for the day of the month, 2 characters
w…Numeric representation of the day of the week
z…The day of the year (starting from 0)
Week:
W…ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)
Month:
F…A full textual representation of a month, such as January or March
m…Numeric representation of a month, with leading zeros
M…A short textual representation of a month, three letters
n…Numeric representation of a month, without leading zeros
t…Number of days in the given month
Year:
L…Whether it’s a leap year
o…ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)
Y…A full numeric representation of a year, 4 digits
y…A two digit representation of a year
Time:
a…Lowercase Ante meridiem and Post meridiem
A…Uppercase Ante meridiem and Post meridiem
B…Swatch Internet time
g…12-hour format of an hour without leading zeros
G…24-hour format of an hour without leading zeros
h…12-hour format of an hour with leading zeros
H…24-hour format of an hour with leading zeros
i…Minutes with leading zeros
s…Seconds, with leading zeros
u…Milliseconds (added in PHP 5.2.2)
Timezone:
e…Timezone identifier (added in PHP 5.1.0)
I…(capital i)…Whether or not the date is in daylight saving time
O…Difference to Greenwich time (GMT) in hours
P…Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)
T…Timezone abbreviation
Z…Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.
Full Date/Time:
c…ISO 8601 date (added in PHP 5)
r…