GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Setting up cache control header in htacces files (https://gfy.com/showthread.php?t=1071880)

p3rsian 06-19-2012 12:46 AM

Setting up cache control header in htacces files
 
i am trying to tell browsers to get a fresh copy of the site (JOOMLA based) after x hours using this code in htaccess.
main question is if its ok to put PHP file in there . i could not find a site that has it but since its index.php homepage i need it.

Code:

# 2 HOURS
<filesMatch "\.(html|htm|PHP|css|js)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</filesMatch>

thanx 4 helping

p3rsian 06-19-2012 01:00 PM

:helpme 234567

phypon 06-19-2012 01:25 PM

I've only recently had experience with far future expires headers. Off the top of my head I don't think PHP will matter one way or another. HTML/CSS/js would be how content and images are displayed. Those would be what would need to be cached.

AzteK 06-19-2012 01:30 PM

Quote:

Originally Posted by p3rsian (Post 19012866)
i am trying to tell browsers to get a fresh copy of the site (JOOMLA based) after x hours using this code in htaccess.
main question is if its ok to put PHP file in there . i could not find a site that has it but since its index.php homepage i need it.

Code:

# 2 HOURS
<filesMatch "\.(html|htm|PHP|css|js)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</filesMatch>

thanx 4 helping

to boro, batcheh mekhad htaccess yad begireh. Mamanet medooneh to enja hasty?

RazorSharpe 06-19-2012 03:29 PM

Quote:

Originally Posted by AzteK (Post 19013864)
to boro, batcheh mekhad htaccess yad begireh. Mamanet medooneh to enja hasty?

Been a long while since I've heard Farsi :)

AzteK 06-19-2012 03:52 PM

Quote:

Originally Posted by RazorSharpe (Post 19014014)
Been a long while since I've heard Farsi :)

:winkwink: toh az koja medooni?

raymor 06-19-2012 04:39 PM

PHP or not doesn't matter. That's fine for all of the standards compliant browsers. The tricky part is that for IE you need to tell it to not cache in three different ways in order for it to be reliable.

For older versions of IE, that needs to include in the <head> which must be placed at the ends of the document, or at very least place the caching adjectives at the end of the head. The problem is that since IE doesn't cache anything less than 512 bytes anyway, so when it refs the headers it hasn't yet decided to turn on cache, so that's too early to turn off the cache.

On the other hand, IE doesn't know how to handle the Vary header, so it skips when thete is any Vary header. If you set it to Vary on hostname or URL that shouldn't hurt anything because OF COURSE different URLs have different content, but IE isn't smart enough to figure that out, so it skips caching.


All times are GMT -7. The time now is 07:01 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123