301 Redirect Online

PHP 301 redirect generator

If You have no access to the server or htaccess file, here is the bulk PHP redirect generator to make fastest possible redirects in this situation. It generates header location rules for 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 301 redirect code into your PHP 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 PHP side redirects 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 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 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';