Filed under:

How to create a redirect (PHP)




How to create a redirect (PHP)...

If you want to have your domain redirect to another page or folder on your domain you can create an index.php page and enter the following code...

<?php
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: /shop/');
?>


In this example if you put the index.php file in your root folder of www.domainname.com any visitors would be redirected to www.domainname.com/shop/

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
article icon What is phpMyAdmin? (Views: 2032)
article icon What is PHP? (Views: 2504)
article icon PHP Error messages (Views: 1399)

Language: