Rewriting multiple domains to one domain with .htaccess
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
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
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.







