X

RewriteRule Generator for Apache .htaccess

2021-05-25 All URL are expected to start with 'https'.

I hope this tool will help you.

Test your site once you are done with this links checker.

A simple solution is to create a simple html page on your site with only all the old links in it.
Add a link to this temporary test page in one of your page, e.g. in the sitemap, whatever.
Once you have finished your tests, just comment this link to hide it, ready for the next time.

Generate - UnGenerate Apache .htaccess RewriteRule

- generate permanent 'RewriteRule' lines for Apache .htaccess file.
- un-generate 'RewriteRule' lines back to the original lines.

The lines format must be old-url comma new-url without space or tab.

The 'www.' in the old URL is optional.

The trailing / is optional.
TIP: Use a / at the end of an URL to avoid a second HTTP request to the server!

Do not forget to add in the .htaccess file:
- 'Rewrite on' before the generated lines
- 'RewriteCond' before each different domains 'RewriteRule' blocks.

More information about Apache .htaccess file and mod_rewrite.


Field 1 - old-url,new-url lines



Put old-url,new-url lines in Field 1 then click Generate.

Field 2 - RewriteRule lines


Put RewriteRule lines in Field 2 then click UnGenerate.

Examples:

Field 1
https://www.mysite.com/blue/,https://www.mysite.com/red
https://mysite.com/en/cyan,https://www.mysite.com/en-uk/cyan/
https://www.mysite.com/pict/img_01.jpg,https://www.mysite.com/pict/new_door.png
https://www.mysite.com/hello.html/,https://www.mysite.com/welcome.php
https://mysite.com/page01,https://www.mysite.com/red-shirts

Field 2
RewriteRule ^blue\/?$ "https\:\/\/www\.mysite\.com\/red" [R=301,L]
RewriteRule ^en\/cyan\/?$ "https\:\/\/www\.mysite\.com\/en\-uk\/cyan" [R=301,L]
RewriteRule ^pict\/img\_01\.jpg\/?$ "https\:\/\/www\.mysite\.com\/pict\/new\_door\.png" [R=301,L]
RewriteRule ^hello\.html\/?$ "https\:\/\/www\.mysite\.com\/welcome\.php" [R=301,L]
RewriteRule ^page01\/?$ "https\:\/\/www\.mysite\.com\/red\-shirts" [R=301,L]

Problems and suggestions are welcome.

Soon... delete duplicates, group lines by domain, sort...





Copyright © 2009-2021 - Tous droits réservés - Informations légales - Sitemap