Free .htaccess Redirect Generator (301, HTTPS, www)

Free online .htaccess redirect generator. Create 301 redirects, force HTTPS, choose www or non-www, move a domain and get Apache or Nginx rules, then test any URL for chains and loops. It runs in your browser, so nothing is uploaded.

Htaccess Redirect Generator by Utiliby

Free .htaccess Redirect Generator (301 and HTTPS)

Create 301 redirects, force HTTPS, set www or non-www, fix trailing slashes and move a domain. Get Apache .htaccess or Nginx rules and test each URL for redirect chains. No upload.

End a path with /* to redirect a whole folder. Put a query string in the old path to match it. Use 410 for pages you removed on purpose.

Test a URL

See every redirect a visitor would go through with the rules above.

Disclaimer: This free redirect generator works in your browser, so nothing you type is uploaded. The rules assume a standard Apache server with mod_rewrite enabled, or a standard Nginx setup. Hosts differ, and a wrong rule can take a site offline, create a redirect loop or lose search traffic. Back up your current .htaccess or server configuration before you change it, test on a staging copy first and check important URLs after you publish. The URL test is a simplified simulation and assumes each address is a normal page rather than a real file or folder.

Share, cite or embed this tool

Written by the Utiliby editorial team · Last updated October 14, 2026 · Rules and formulas reviewed October 2026

What this free .htaccess redirect generator does

Moving a page, changing a domain, switching to HTTPS or choosing between www and non-www all lead to the same job: telling the server to send visitors, and search engines, from an old address to a new one. On an Apache server that means writing rules in a file called .htaccess. The syntax is easy to get wrong, and one misplaced character can cause a loop or take the site down.

This free online redirect generator writes the rules for you. Choose HTTPS and www settings, trailing slash handling and index file removal, move an old domain, and paste a list of page redirects with 301, 302, 307, 308 or 410 codes. Switch to Nginx for server rules. A built-in test follows any URL through your rules and shows every step, so you can find chains and loops before you go live. It is free, private and needs no sign-up.

Redirect chain compared with a single redirect A chain: three redirects http://wwwhttps://wwwhttps://site/new-page One redirect: faster and keeps more link value http://www/new-page
Every extra step slows the visitor and adds risk. Write rules so each old address goes straight to the final one.

How to create redirect rules in five steps

  1. Enter your domain. Use the bare domain, such as example.com.
  2. Choose the main address. Pick www or non-www, and tick Force HTTPS.
  3. List page redirects. Write each old path, a space and the new path. Add a code at the end when you need something other than 301.
  4. Test it. Enter a few old URLs in the test box and check that each takes one step.
  5. Add it to your server. Back up your current file, paste the rules into .htaccess or your Nginx configuration, and check the result in a browser.

Which redirect code should you use?

CodeMeaningUse it when
301Moved permanentlyA page or site has a new home for good
302Found, temporaryA short-term move, such as a test or a sale page
307Temporary, keeps the methodA temporary move for forms and APIs
308Permanent, keeps the methodA permanent move for forms and APIs
410GoneA page was removed on purpose with no replacement

For nearly all website moves, 301 is correct. Use a temporary code only when the original address will come back.

HTTPS, www and one main address

Search engines treat http://example.com, https://example.com, http://www.example.com and https://www.example.com as four separate addresses. If all four open your site, you have four copies and your links and signals are split between them. Pick one main address, send the others to it with a permanent redirect, and use the same address in your sitemap, canonical tags and internal links. This tool writes one combined rule so that any wrong version goes to the main one in a single step, instead of passing through two redirects.

If your site is behind Cloudflare or another proxy, the server may see every request as plain HTTP even though visitors use HTTPS. In that case a normal HTTPS rule creates a loop, so tick the proxy option to test the forwarded protocol instead.

Moving to a new domain

Common redirect mistakes

Testing your redirects

The test box takes a URL and applies your rules in the order the server would: old domain, page redirects, then the main host and HTTPS, index files and trailing slashes. It repeats until no rule matches and lists each step with its code. A good result is zero or one step. Two or more steps are shown as a chain, and a repeating address is flagged as a loop. The simulation cannot see files on your server, so it treats every address as a normal page. After you upload the rules, check real URLs in a browser or with a header checker.

Troubleshooting

Privacy and how it works

Your browser turns the settings you choose into rewrite rules and runs a small simulation of them on the URL you test. Nothing is uploaded, stored or logged. Print / save summary creates a short report from your entries, and the rest of the page is not included in the print.

Use these free online tools together with this one:

Frequently asked questions

What is an .htaccess redirect generator?

It is a tool that writes redirect rules for the .htaccess file used by Apache web servers. You enter the old and new addresses and settings such as HTTPS and www, and the tool produces rules you can paste into your file.

How do I create a 301 redirect in .htaccess?

Add a line like RewriteRule ^old-page/?$ /new-page [R=301,L] after RewriteEngine On. Enter your old and new paths in the box above and the tool writes the rule for you.

What is the difference between 301 and 302 redirects?

A 301 is permanent and tells search engines to pass the old address to the new one. A 302 is temporary and tells them to keep the old address. Use 301 for moves that will stay, such as a new URL or a new domain.

What are 307 and 308 redirects?

They are the modern equivalents of 302 and 301 that also keep the request method, such as POST. For ordinary pages, 301 and 302 work fine.

How do I force HTTPS with .htaccess?

Tick Force HTTPS and enter your domain. The tool writes a rule that sends every HTTP request to the HTTPS address. If your site is behind Cloudflare, tick the proxy option so the rule uses the forwarded protocol and avoids a loop.

How do I redirect non-www to www?

Choose Always use www as the main address. The tool adds a rule that sends the bare domain to the www version in a single step, together with HTTPS if you chose it.

What is a redirect chain and why is it bad?

A chain is when one redirect leads to another before the final page. Each step adds delay, and some crawlers stop after a few steps. The test box shows every step so you can fix them.

What is a redirect loop?

A loop is when redirects send a visitor back and forth forever, and the browser shows an error such as too many redirects. The tool warns when a rule points to itself and when it finds a loop in the test.

How do I redirect a whole folder?

End the old path with /* and give a destination, for example /blog/2019/* /blog/. Everything under the old folder is sent to the new one, and the rest of the path is kept.

How do I redirect an old domain to a new domain?

Enter your new domain at the top and the old domain in the move field. The tool keeps the path, so old-site.com/page goes to new-site.com/page. Keep the old domain registered and the redirect in place for at least a year.

What does 410 mean?

A 410 status says a page is gone on purpose. Search engines may drop it from results faster than a 404. Use it for removed pages that have no replacement.

Does the tool support Nginx?

Yes. Choose Nginx and you get server blocks and location rules instead of .htaccess lines. Nginx does not use .htaccess files, so paste the rules into your server configuration and reload Nginx.

Where is the .htaccess file?

It sits in the root folder of your site, often called public_html or www. It is a hidden file because its name starts with a dot, so turn on hidden files in your file manager.

Will redirects hurt my SEO?

Redirects done correctly pass most of the value of the old page to the new one. Problems come from chains, loops, redirecting many pages to the home page and leaving internal links pointing at old addresses.

How do I remove index.php or index.html from URLs?

Tick the option. The tool writes a rule that redirects /index.php and /index.html to the clean folder address, which prevents duplicate versions of the same page.

Is my data uploaded anywhere?

No. The tool runs in your browser. The paths and domains you enter are not sent to Utiliby or to any other server.

What can I print or save from the page?

Print / save summary gives a short report with your settings and test results. Download file saves the rules as .htaccess or an Nginx file. Copy code puts them on your clipboard.

Sources and further reading

Sources were consulted in October 2026. Standards and rules can change, so always check the official page for your situation.

Disclaimer: This free redirect generator works in your browser, so nothing you type is uploaded. The rules assume a standard Apache server with mod_rewrite enabled, or a standard Nginx setup. Hosts differ, and a wrong rule can take a site offline, create a redirect loop or lose search traffic. Back up your current .htaccess or server configuration before you change it, test on a staging copy first and check important URLs after you publish. The URL test is a simplified simulation and assumes each address is a normal page rather than a real file or folder.