php header

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

php header

Post by Vegan »

2 items for the header, not sure which should be first or does it matter?

Code: Select all


<?php
 Header("Cache-Control: must-revalidate");
 $offset = 60 * 60 * 24 * 7;
 $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
 Header($ExpStr);
?>
<!-- ETag allows a search engine the ability to identify page changes easily -->
<?php header("ETag: " . sha1(date("YmdHis", getlastmod()))); ?>

Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: php header

Post by Celauran »

Doesn't matter in the slightest
W3C wrote:The order in which header fields with differing field names are received is not significant. However, it is "good practice" to send general-header fields first, followed by request-header or response- header fields, and ending with the entity-header fields.
http://www.w3.org/Protocols/rfc2616/rfc ... tml#sec4.2
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: php header

Post by Vegan »

I have been considering more ideas for search engines and general site improvements

I have one other header so I guess they can be piled as needed

Code: Select all

<?php header('Content-Type: text/html; charset=ISO-8859-1'); ?>
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: php header

Post by Celauran »

[text]charset=ISO-8859-1[/text]
Oh, don't do that.
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: php header

Post by Vegan »

unfortunately I need that due to some generated content

if I could I would use utf-8
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
Post Reply