Easy ways to create a 301 redirect in code

Since my post the other day on A simple way to correct the hostname for your website I’ve been thinking about ways to do the same in other languages so I thought I should share my findings with you. I’ll only cover the most common web languages and methods, but if you think I’ve missed any out then add them in the comment section below for the benefit of others.
Continue reading Easy ways to create a 301 redirect in code

A simple way to correct the hostname for your website

There are several ways to force the correct hostname on a website. Normally this is done with mod_rewrite within the vhost or within the .htaccess file (if allowed). However there is a very simple way to do it with PHP. All you need to do is check that the value of $_SERVER[‘HTTP_HOST’] matches the domain name you want your site to work under.

Continue reading A simple way to correct the hostname for your website