Web Hosting Talk







View Full Version : mod_expires


niteswmr
09-21-2003, 06:28 PM
After noticing the number of "hits" to common image files in my stats, I did some googling and concluded that using the mod_expires functions in my common images directory could speed up my web pages and reduce bandwidth used. I asked my host if they could enable it on the server, and this is their reply:

"As far as the expires module this could cause other adverse effects to other clients. It also isnt just simple as just turning an option on. It is a very involved process that inclues completely rebuilding apache and the other web pages services. Due to all above outlined reasons we can not enable this mod on our servers."

To confuse matters further, they added:

"You can use ports 2083 (cpanel) and 2087 (whm) using https to access them securely. Also we advise that you do not to save the passwords. You can also wipe the history and tempory internet files. Also you can clear out AutoComplete and cookies. Another thing would be to change your passwords frequently."

Now am I missing something here, or are these guys one close to the most clueless admins out there? My previous encounters would indicate the latter, but I thought I'd ask. Failing getting mod_expires to work, I'm considering fetching all my images using a "get.php?img=foo.gif" method where I can manually insert a "Expires" header myself. Comments?

thanks

wKkaY
09-21-2003, 06:58 PM
completely rebuilding apache ? nahh .. if they already have the apache building tools and source they could issue a

apxs -i -a -c mod_expires.c

and have it built automagically .

your idea sounds pretty good except that it'll take some extra cpu time on your host (due to their shortcoming anyway heh :) ) . btw , you can use htaccess and mod_rewrite to mask the get.php?img= so you don't have to change any of your pages at all :)

niteswmr
09-21-2003, 07:08 PM
wKkaY, using mod_rewrite is something I hadn't even thought of - nice idea! I'm googling to figure out how it works, but if you already know then please do tell.

These webhosts have been *extremely* clueless in the past, and give ridiculous reasons for not changing anything I've asked for. However their servers have been stable for the month I've been with them and I can't be bothered moving all my domains again.

wKkaY
09-21-2003, 07:22 PM
i'm not very familiar with mod_rewrite either , it's mostly trial and error for me :) but gallery (http://gallery.sourceforge.net) uses them for that pupose .

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /photos/
RewriteRule ^([^\.\?/]+)/([0-9]+)$ /photos/view_photo.php?set_albumName=$1&index=$2 [QSA]
RewriteRule ^([^\.\?/]+)/([A-Za-z_0-9\-]+)$ /photos/view_photo.php?set_albumName=$1&id=$2 [QSA]
RewriteRule ^([^\.\?/]+)/$ /photos/$1 [R]
RewriteRule ^([^\.\?/]+)$ /photos/view_album.php?set_albumName=$1 [QSA]
</IfModule>

niteswmr
09-21-2003, 09:31 PM
This seems to do the trick:

RewriteEngine On
RewriteRule .*\.(gif|GIF|jpe?g|JPE?G)$ get.php?img=$0 [L]

Knogle
09-23-2003, 03:11 AM
That should work. Anyone who attempts to download a gif/jpg file will have to view it through get.php.