my latest
Rambling: 323 days of failure - read it
Fri 19th Nov
Tweet: kevbaldwyn: 6 hour ferry ride on the slowest boat in the Maldives and 3 hours later I still feel like I'm on a boat.
Wed 15th Feb
Code: Image and resource caching with htaccess - read it
Wed 23rd Mar
my photos
Hassan II Mosque, Wide Angle - Casblanca
Hassan II Mosque, Front - Casblanca
Hassan II Mosque, Polarised - Casblanca
Hassan II Mosque - Casblanca
Casablanca
The magical world of Disney
The Disney Castle
Snowy Branch
 

Rewriting multiple domains to one domain with .htaccess

Monday 2nd August '10

If you are running a website with more than one domain ie; www.example.com and www.example.co.uk, then you are probably aware that if you don't have all your domains resolving to one host only then you can suffer from a duplicate content penalty, where the ranking for your webpages is split across multiple domains.

The more common problem though is when you have http://www.example.com and http://example.com both resolving to the same place. Even though they are the same domain, google does treat them as separate entities.

I find this useful also when dealing with flash movies that are requesting content from a php script for example, with everything resolving to the same host you don't...

Uploading large files with php

Friday 15th October '10

I'm posting this as much for my own reference as much as anything as I'm always looking it up!

The default upload_max_filesize in php is 8MB and if you are dealing with uploading .pdf files or videos and any large files then I expect this won't be enough. Place these few lines in an .htaccess file and you should be good to go (amend the values as you see fit).

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200

Image and resource caching with htaccess

Wednesday 23rd March '11

This is as much a bookmark for myself as anything. I just discovered this .htaccess trick to easily set resource caching with apache. It requires mod_headers enabled which comes compiled by default but switched off. Then all you need do is add something like this to your .htaccess file:

<IfModule mod_headers.c>
	<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
	Header set Cache-Control "max-age=2592000"
	</FilesMatch>
</IfModule>

Which will cache images and flash for one month. The link posted above has loads more info.