vBulletin 4 optimized .htaccess
This .htaccess will optimize your server and increase your page load scores (higher score is a good thing). This will set the images to expire after a certain amount of time as well as numerous other optimization tricks for your server. These set the expires headers for images, and set some cache-control headers as well. Place this at the very top of your .htaccess file, remember to back up and test first.
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 259200000 seconds"
ExpiresByType image/jpeg "access plus 259200000 seconds"
ExpiresByType image/png "access plus 259200000 seconds"
ExpiresByType text/css "access plus 60480000 seconds"
ExpiresByType text/javascript "access plus 21600000 seconds"
ExpiresByType application/x-javascript "access plus 21600000 seconds"
</ifModule>
<ifModule mod_headers.c>
<filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=25920000, public"
</filesMatch>
<filesMatch "\\.(css)$">
Header set Cache-Control "max-age=6048000, public"
</filesMatch>
<filesMatch "\\.(js)$">
Header set Cache-Control "max-age=2160000, private"
</filesMatch>
<filesMatch "\\.(xml|txt)$">
Header set Cache-Control "max-age=2160000, public, must-revalidate"
</filesMatch>
<filesMatch "\\.(html|htm|php)$">
Header set Cache-Control "max-age=1, private, must-revalidate"
</filesMatch>
</ifModule>
<ifModule mod_headers.c>
Header unset ETag
</ifModule>
FileETag None
<ifModule mod_headers.c>
Header unset Last-Modified
</ifModule>
about 2 months ago
Nice bit of code David. Have you installed vb4 yet ?
about 2 months ago
Worked like a charm according to firebug! Thanks a million for this
about 2 months ago
Thanks david, I installed it on my VB4 site after a recommendation from someone over at vbulletin.org.
about 2 months ago
Do you recommend somthing like this for vB3 installations as well.
What’s the difference in vB4 htaccess compared to vB3?
Bookmarked, thanks
about 2 months ago
Yes, you can even use this in previous vBulletin versions, or on just about any web site that makes use of images actually to get a performance improvement.
about 1 month ago
worked like a charm.One issue i encountered.For those that is on a windows server you have to change the module name from to this , after adding the above info i was getting a random Apache fault module php5ts.dll errors and this happened after i added the script.But after changing the module name everything is working fine…
thanks
about 1 month ago
ok it didnt take the info properly form this ifModule mod_expires.c to this ifModule expires_module