301 Redirect Online

Htaccess 301 redirect RewriteRule generator

    Copy and paste two columns with old and new urls (for example from Excel) into first field. Push "Generate" button. Once our advanced bulk htaccess 301 redirect generator created permanent redirect code, insert it into your Apache .htaccess file. Domains should start from http:// or https://.

Paste lines with Old and New urls here:

Copy Apache .htaccess rewrite rules from here:

Separator between old and new url in a line:

Add old query strings to new urls:

Query strings exact match policy:

To strip host name or not to strip

If You need more flexible solution for further usage on other hosts, staging or testing environments, there is an option to strip host name. But, if you need to be sure that rules be applied exactly, with conditions on certain hosts, better not to strip. 

Query strings

Most common situation is when You replacing urls containing query strings with urls without query strings. This is why the default action with query strings is to skip ones. Also possible to add query string to new url or to combine old and new query strings.  You will need to select appropriate bulk 301 redirect generator option.

What does "Query strings exact match policy" mean?

Let us consider an example: /old_url?str1=val1&str2=val2 .
If to choose "Exact match", urls with exactly the same quiery string will be redirected.
If to choose "Exact set", both /old_url?str1=val1&str2=val2 and /old_url?str2=val2&str1=val1 will be redirected.
If to choose "Contain", any of the urls /old_url?str1=val1, /old_url?str1=val1 will be redirected.

The reason for not to escape new urls

In rare cases, if your valid new url contains special chars like "#"(%23), you may need to choose an option "Do not escape new urls" in order to obtain good result after 301 redirect.

Order of rewrite rules

     The order of the rewrite rules is important. Check Your .htaccess file for redirect rules.  Be sure that more narrow rewrite rules are before more wider ones.

How to insert the code into .htaccess file

First of all, do not insert the code inside common code block generated by WordPress, Joomla or other CMS, because this way the code can be overwritten after CMS update. Place the code at the begging of the file or where other working redirects located.

Why not to use "Redirect 301" directives

"Redirect 301" or "Redirect permanent" is a detective of mod Alias, but not mod Rewrite. There are a lot of reasons for not to use it. It can't do checks and operations with query strings. It can't check domain names. It will redirect whole directories, but not individual urls. Finally, It has separate flow. If you have a lot of old redirect rules with mod Alias, please, use 301 RedirectMatch generator for htaccess.

How to choose a separator

Spaces, commas and semicolons can be a part of urls.  This tool do not support automatic CSV format recognition and escaping.  If You have such symbol in urls, You will need to choose another separator in your CSV data and htaccess 301 redirect generator options to avoid problems with the generation of rewrite rules.

I need more, not just page to page redirection. Where can I find more directions?

For example, You can refer Apache documentation. More about mod_rewrite 301 redirects here.