SEO Tools

.htaccess Redirect Generator

Create clean 301/302 redirects, force HTTPS and set www or non-www — copy the rules straight into your .htaccess.

Rate this tool
Redirects (old path → new path)
.htaccess output

How to use the .htaccess Redirect Generator

  1. Add each redirect as an old path → new path pair, and pick 301 or 302.
  2. Optionally tick “Force HTTPS” and choose a www preference.
  3. Copy the generated rules into your site’s .htaccess file.

About the .htaccess Redirect Generator

On Apache servers, the .htaccess file controls redirects and rewrite rules — but the syntax is fiddly and one wrong character can take a site down with a 500 error. This generator writes the rules for you. Add your old-to-new URL pairs, choose whether each is a permanent 301 or temporary 302, and it produces a tidy, correctly-ordered block you can paste straight in.

It also handles the two rules almost every site needs: Force HTTPS, which sends every visitor to the secure version, and a www / non-www preference so your domain resolves one canonical way. Both matter for SEO — duplicate HTTP/HTTPS and www/non-www versions split your ranking signals, and 301s pass link equity from old URLs to new ones so you keep the value of pages you have moved or renamed.

Everything is generated in your browser. Place the rules near the top of your .htaccess, and always keep a backup of the original first. To guide crawlers further, pair this with the robots.txt generator and the sitemap generator.

Frequently asked questions

What is the difference between 301 and 302?

A 301 is a permanent redirect and passes SEO value to the new URL — use it for moved pages. A 302 is temporary and tells search engines the old URL will return.

Where does this file go?

The .htaccess file lives in your website's root folder on an Apache server. Add these rules there; if one already exists, back it up before editing.

Will this work on Nginx?

No. .htaccess is an Apache feature. Nginx uses a different configuration syntax, so these rules will not apply there.