This guide explains how to use .htaccess Redirect Generator, step by step, with screenshots of the real tool. It is written for site owners, developers and SEOs who look after crawling, indexing and site health. Create 301 and 302 redirects, force HTTPS and choose www or non-www for Apache servers. Bulk redirects supported.
Quick answer: To use the .htaccess Redirect Generator, open the free tool, paste the redirects, choose the redirect type, choose the force HTTPS and choose the preferred domain, then copy the text it creates. Everything runs in your browser, so there is no sign up and nothing you type is stored on a server.
On this page

What is the .htaccess Redirect Generator?
htaccess redirect generator. Create bulk 301 and 302 redirects, force HTTPS and www or non-www rules for Apache websites.
Use a 301 redirect when a page moves for good. It passes most of the old page’s link value to the new URL, so you keep your rankings and backlinks.
How to use .htaccess Redirect Generator step by step
-
Step 1: Open the .htaccess Redirect Generator
Go to the .htaccess Redirect Generator on hasnainsanmal.com. It loads with example values already filled in, so you can see how it works straight away. It works the same way on a phone, tablet or computer.
-
Step 2: Paste Redirects
Paste or type your text into Redirects (old path | new URL, one per line). The example starts with: /old-page/ | https://example.com/new-page/ /blog/old-post/ |….
-
Step 3: Choose Redirect type
Choose an option from Redirect type. Options include 301 Permanent and 302 Temporary. The example uses 301 Permanent.
-
Step 4: Choose Force HTTPS
Choose an option from Force HTTPS. Options include Yes and No. The example uses Yes.
-
Step 5: Choose Preferred domain
Choose an option from Preferred domain. Options include Do not change, Non-www and www. The example uses Do not change.
-
Step 6: Read the results
The output appears inside the tool card. Change any input to compare different scenarios.

Screenshot of the .htaccess Redirect Generator results. -
Step 7: Copy or download the output
Use Copy code to take the result into your document, CMS, spreadsheet or report.
What does each field in the .htaccess Redirect Generator mean?
| Field | What to enter | Example |
|---|---|---|
| Redirects | Text, one item per line where asked | /old-page/ | https://example.com/new-page/ /blog/old-post/ |… |
| Redirect type | Choose one option (301 Permanent, 302 Temporary) | 301 Permanent |
| Force HTTPS | Choose one option (Yes, No) | Yes |
| Preferred domain | Choose one option (Do not change, Non-www, www) | Do not change |
What does a worked example look like?
With the example inputs (Redirect type: 301 Permanent, Force HTTPS: Yes and Preferred domain: Do not change), the .htaccess Redirect Generator returns: # Generated by hasnainsanmal.com <If, Module mod_rewrite.c> Rewrite, Engine On # Force HTTPS Rewrite, Cond %{HTTPS} off Rewrite, Rule ^(.*), $ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </If, Module> # Page…
Replace the example with your own input to get your own result, then review it before you use it.
How do you get the best results from the .htaccess Redirect Generator?
- Always back up .htaccess before editing it.
- Redirect each old URL to the closest matching new page, not the homepage.
- Avoid redirect chains: point straight to the final URL.
- Re-check after every theme, plugin or server change.
- Confirm fixes in Google Search Console with URL Inspection.
For background, read the Google crawling and indexing documentation. If you are working on a related task, our guide on how to use the Canonical Tag Generator walks through it the same way. You can also browse all free Technical SEO Tools.
What mistakes should you avoid with the .htaccess Redirect Generator?
- Testing on a staging copy and forgetting that the live site has different rules.
- Fixing one URL and not checking the template that created the problem.
- Changing URLs without adding 301 redirects.
Key terms
- 301 redirect
- A permanent redirect that sends users and search engines from an old URL to a new one. It passes most ranking signals to the new address, which makes it the standard choice when a page moves or two pages are merged.
- Search engine optimisation
- The practice of improving a website so it ranks higher in unpaid search results. It covers technical health, on-page content, links and user experience, and it follows Google Search Essentials rather than shortcuts.
- Browser based tool
- A tool that runs entirely in your web browser with JavaScript, so the data you enter is processed on your own device. It works instantly without sign up, but it cannot fetch other websites because of browser security rules.
Related free tools
Frequently asked questions
Is the .htaccess Redirect Generator free to use?
Yes. The .htaccess Redirect Generator is completely free, with no sign up, no daily limit and no watermark. It is one of more than 500 free SEO and marketing tools on hasnainsanmal.com.
Is my data stored when I use the .htaccess Redirect Generator?
No. The .htaccess Redirect Generator runs in your browser with JavaScript, so the values and text you enter are processed on your own device and are not sent to or saved on our server.
How accurate is the .htaccess Redirect Generator?
It creates a solid first draft from your inputs. Always review and edit the output so it is accurate, specific and sounds like you before you publish or send it.
Does the .htaccess Redirect Generator work on a phone?
Yes. The tool is built for screens from 360 pixels wide, so you can use the .htaccess Redirect Generator on a phone, tablet or computer in any modern browser.
Can I use the .htaccess Redirect Generator for client work?
Yes. You can use the results for your own sites and for client projects. Check the output first, and keep a note of the inputs you used so you can repeat the check later.
What should I do after using the .htaccess Redirect Generator?
Apply the result on your page, campaign or document, then measure the effect. If you would like expert help, see the SEO services or message Hasnain on WhatsApp for a free recommendation.
How we checked this guide: every step and screenshot was taken from the live .htaccess Redirect Generator on 2 November 2026. Further reading: Google SEO Starter Guide.




