301 Redirect Online

PHP 301 redirect generator

If You have no access to the server and .htaccess file, here is the bulk pure PHP  301 redirect generator to make the fastest possible redirects in this situation. It generates "header location" rules for the exact page to page redirection based on simple "if" conditions and some regular expressions syntax.  Please, read notes at the bottom. 

Paste lines with Old and New urls here:

Copy PHP header location rules from here:

Separator between old and new url in a line:

Add old query strings to new urls:

Query strings exact match policy:

How to use?

Copy and paste columns of old and new urls, for example from Google docs or Excel, into first field. Push "Generate" button. Copy PHP header 301 redirect code into your application. Learn more about  usage of PHP header function for 301 and other redirects here.

When to use?

If you need fast 301 redirects, but can't access your server, you may use pure PHP header function to do 301 page redirection. It is still good for SEO and other purposes.

Where should I place the code?

The faster the better. So the earlier the better. Place your PHP header 301 code at the begging of the enter point php file of your application. In many cases, it can be index.php file.

How should I place the code?

Many CMS systems like WordPress can rewrite enter point file on update. So, create some file, for example 301-redirects.php, and place your PHP header 301 redirect code in it. Include this file in your enter point file. For example, add such a line at the beginning: include '301-redirects.php';