How to use the .htaccess redirect generator
- List your redirects: the old path, a space or comma, then the full new URL.
- Choose whether to force HTTPS and www or non-www.
- Copy the code. Back up your existing .htaccess file (in your site’s root folder, via File Manager or FTP).
- Paste the code at the top of .htaccess, above “# BEGIN WordPress”, and save. Test the old URLs in a private browser window.
301 vs 302 redirects
- 301 (permanent): the page has moved for good. Google passes the old page’s ranking signals to the new page. Use this in almost every case.
- 302 (temporary): the move is short-term, for example during maintenance or a seasonal offer.
When do you need redirects?
- You changed a page URL or slug.
- You deleted a page and have a close replacement.
- You moved from HTTP to HTTPS or changed domain.
- You merged two similar pages into one.
Avoid these redirect mistakes
- Redirect chains: A to B to C slows pages and wastes crawl budget. Point A straight to C.
- Redirect loops: A to B and B back to A breaks the page.
- Sending everything to the homepage: redirect each old page to the most relevant new page instead.
On Nginx or LiteSpeed-only setups .htaccess may not work. On WordPress you can also use the Redirections module in Rank Math.
Frequently Asked Questions
Where is the .htaccess file?
In the root folder of your website (often public_html). It starts with a dot, so turn on “show hidden files” in your file manager.
Will redirects keep my Google rankings?
A 301 redirect to a closely matching page passes almost all ranking value to the new URL.
How long should I keep 301 redirects?
Keep them for at least a year, and ideally permanently, especially if other websites link to the old URLs.
Can I break my site by editing .htaccess?
A mistake can cause a 500 error. Always keep a backup so you can restore it in seconds.
Related Free Tools
Robots.txt GeneratorBuild a clean robots.txt file for your website.URL Slug GeneratorTurn any title into a clean, SEO-friendly URL.Free Website Audit ToolCheck your website speed, SEO and Core Web Vitals in one click.Hreflang Tag GeneratorCreate hreflang tags for multi-country and multi-language sites.Meta Tag GeneratorGenerate all the head tags a page needs in one go.Schema Markup GeneratorCreate JSON-LD for LocalBusiness, FAQ, Article, Product and Breadcrumbs.