firewall Spyware removal internet speed test web security service free software and tips


Go Back   Web Security > Web Site Optimization > Optimization Techniques
FAQ Members List Search Today's Posts Mark Forums Read

Optimization Techniques Ways to optimize your website so that you rank better on the search engines. Questions on how to change your site so it attacts more visitors, and other similar topics.

Advertisements

DeOptimization

Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 09-24-2007,
Senior Member
 
Join Date: Feb 2007
Posts: 360
Default Time Warp

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

Last edited by Actual; 09-24-2007 at .
Reply With Quote
  #22 (permalink)  
Old 09-25-2007,
AMPC's Avatar
Administrator
 
Join Date: Jan 2007
Posts: 1,415
Default meta expires

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.
Reply With Quote
  #23 (permalink)  
Old 10-03-2007,
Senior Member
 
Join Date: Feb 2007
Posts: 360
Question On Board

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

Last edited by Actual; 10-03-2007 at .
Reply With Quote
  #24 (permalink)  
Old 10-07-2007,
Senior Member
 
Join Date: Feb 2007
Posts: 360
Default How Short Is Too Short?

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
Reply With Quote
  #25 (permalink)  
Old 10-08-2007,
AMPC's Avatar
Administrator
 
Join Date: Jan 2007
Posts: 1,415
Default Expire 5 minutes from now

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.
Reply With Quote
  #26 (permalink)  
Old 10-08-2007,
Senior Member
 
Join Date: Feb 2007
Posts: 360
Default Thanks Jim!

I think that's what I'll do, five minutes.

Thanks,

Roger
Reply With Quote
  #27 (permalink)  
Old 10-09-2007,
Senior Member
 
Join Date: Feb 2007
Posts: 360
Question Zurich

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

Last edited by Actual; 10-09-2007 at .
Reply With Quote
  #28 (permalink)  
Old 10-09-2007,
AMPC's Avatar
Administrator
 
Join Date: Jan 2007
Posts: 1,415
Default meta expires date format

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...» RFC 2822 formatted date
U...Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)

Some countries have adopted non-standard time zones, usually 30 minutes offset such as Southeastern Labrador, Newfoundland, Iran, Etc.

Even better, check out Nepal - Nepal’s time zone of UTC + 5:45 was adopted in 1986 [5]. This is the nearest quarter-hour from Greenwich to the local mean time of Nepal’s capital Kathmandu, which is at 85°19'E or 5:41:16. Old CIA maps, 1995 and earlier, have Nepal at 5:40, which may be their approximation of Kathmandu’s local mean time.

It's never easy, is it

Regards,

Jim.
Reply With Quote
  #29 (permalink)  
Old 10-10-2007,
Senior Member
 
Join Date: Feb 2007
Posts: 360
Question Time

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
Reply With Quote
  #30 (permalink)  
Old 02-14-2008,
Senior Member
 
Join Date: Feb 2007
Posts: 360
Default Double Check

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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is .


Powered by a CPU
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.3.2 © 2009, Crawlability, Inc.