.htaccess Redirect Generator

Generate Apache .htaccess rules for 301 or 302 page redirects, forcing HTTPS and adding or removing www, for cPanel and Hostinger hosting.

Runs on your device

Result

Results appear here after you select “Generate”.

What it does

When you rename pages or move domains, 301 redirects pass visitors and most ranking signals to the new URL. Paste "old-path new url" pairs and get mod_rewrite rules with special characters escaped.

How to use it

  1. List one redirect per line: /old-page/ /new-page/.
  2. Choose 301 or 302, plus HTTPS and www options.
  3. Add the rules to the top of your .htaccess and test.

Example

The example fills in realistic values and runs the tool. Select Try an example above to see it.

When it helps

  • Site migrations.
  • Renamed blog posts.
  • Enforcing HTTPS on shared hosting.

Questions

301 or 302?

301 is permanent and should be used for moved content. 302 is temporary and tells search engines to keep the old URL.

Will this work on Nginx?

No. These rules are for Apache and LiteSpeed, which cPanel and hPanel hosting use.

More seo tools

See all 10

People also use

Browse all 200 tools