PHP Redirect 301 permanently

You may want redirect one website to another for some reason. This article show you how to redirect a website to another using php scrips. When you do it should be more search engine friendly at any cost.

PHP Redirect Code

Basically you can avoid the first line, but this would result in “302 Moved Temporarily” redirect instead of 301. But keep this in mind 301 redirects are more search engine friendly.

You can redirect to inner pages also as shown below:

Why I used exit in here, after the redirect header function we should not print anything, even a white space will cause stopping the redirection and showing an error.

Editorial Staff

Editorial Staff at tutsplanet is a dedicated team to write various tutorial articles.