PHP logo

PHP logo

Sometimes you might want to redirect your visitors to a new URL address. One reason you may want to do this is that the page they are trying to access no longer exists.

There are 3 types of redirection, 301, 302 and 303. ‘Redirection 301’ is for that pages that are moved permanently.

In PHP, we can make a 301 with the following code:

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.new-location.com");
exit(); ?>