Htaccess Redirect Generator
Generate correct .htaccess 301 redirects — single pages, folders or whole domains.
How to use Htaccess Redirect Generator
- Pick the redirect type — single page, folder, whole domain, or www/HTTPS canonicalization.
- Enter the old and new URLs — paths for same-site moves, full URLs for cross-domain.
- Copy the generated block into the .htaccess file at your site root (top of the file for rewrite rules).
- Test immediately in a private/incognito window, and verify with our Redirect Checker that it returns exactly one 301 hop.
What is Htaccess Redirect Generator?
An .htaccess redirect generator writes the Apache configuration lines that send visitors — and search engines — from an old URL to a new one. The workhorse is the 301 redirect (moved permanently): Redirect 301 /old-page/ https://example.com/new-page/. Browsers follow it instantly and Google transfers the old URL's ranking signals to the new address.
The syntax is unforgiving: one typo in an .htaccess file can 500-error the whole site, and a wrong pattern can loop redirects infinitely. Generating tested lines beats improvising them — especially for pattern-based rules (RewriteRule) that use regular expressions.
About the Htaccess Redirect Generator
Choose what you're redirecting — a single page, a folder, a whole domain, or www/non-www and HTTP→HTTPS canonicalization — enter old and new URLs, and copy the correct .htaccess block.
The cases that come up constantly: retiring a page (Redirect 301 /old.html to the new URL — do this instead of deleting, or the page's inbound links die as 404s); moving a site to a new domain (RewriteRule sending everything across while preserving paths); and forcing one canonical address so example.com, www.example.com, and the HTTP versions all land on https://www — search engines treat them as separate URLs otherwise, splitting your rankings.
Deployment: append the lines to the .htaccess file in your site root (it may be hidden — enable "show hidden files"), then test in a private window. Use 301 for permanent moves — it passes SEO value; use 302 only for genuinely temporary detours, because it tells Google to keep the old URL indexed.
Frequently Asked Questions
Learn more
How to Set Up 301 Redirects (.htaccess Guide)
Moved or renamed a page? A 301 redirect preserves SEO and sends visitors to the right place. Here is how to set them up.
Read the guide