php programming

HTTP 301 Redirect using PHP

You can use PHP header() function to do redirect.

To do 301 redirect, use

For 302 redirect, use

If you need to redirect a site to new site keeping same URL structure, you can use

Redirect a site to HTTPS using PHP

This PHP script will redirect web site visitor to HTTPS (SSL) url. You can add this in your index.php of the web site

Move a site to new URL using PHP

You can also use Apache mod_rewrite .htacess to do the redirection.