.htaccess Redirect Generator
Free .htaccess redirect generator: create 301 and 302 redirects, force HTTPS, www or non-www, move a domain and turn dynamic URLs into clean ones.
- 100% free
- No sign-up
- Runs in your browser
return 301 or rewrite in the server settings instead.Redirect 301 /old-page.html https://example.com/new-page/
Turn a dynamic URL into a clean, SEO-friendly URL
Paste a URL with query parameters (like ?id=42) to get a clean URL and the matching Apache and Nginx rewrite rules.
Before (dynamic)
https://example.com/product.php?id=42&category=shoes
After (static, SEO-friendly)
https://example.com/product/42/shoes/
RewriteEngine On RewriteRule ^product/([^/]+)/([^/]+)/?$ product.php?id=$1&category=$2 [L,QSA]
rewrite ^product/([^/]+)/([^/]+)/?$ /product.php?id=$1&category=$2 last;
Why rewrite URLs?
- Keywords in the path are a minor ranking signal and improve click-through rates.
- Static-looking URLs are easier to share, remember and cite.
- Fewer parameters mean fewer duplicate-content variations for crawlers.
- Remember to 301-redirect the old dynamic URLs and update your canonical tags.
Webmaster Tools
About the .htaccess Redirect Generator
The .htaccess Redirect Generator writes redirect rules for Apache web servers, which most shared hosting uses. Choose what you need: a 301 or 302 redirect for one page, forcing HTTPS, choosing www or non-www, moving a whole site to a new domain, adding or removing trailing slashes, hiding index.php or .html, or custom error pages.
Each option comes with a short explanation of what the rule does. Copy the result into the .htaccess file in the root folder of your site.
Below it, the URL rewriter turns a dynamic address such as product.php?id=42 into a clean, readable address, with matching Apache and Nginx rewrite rules.
How to use this tool
- 1Choose the redirect type.
- 2Fill in the old path and new address, or your domain.
- 3Copy the generated rules.
- 4Back up your .htaccess file, then paste the rules near the top.
- 5Test the result with the Redirect Checker.
Best-practice tips
- Use 301 for permanent moves; it passes the old page’s value to the new one.
- Always back up .htaccess first: one wrong character can take the whole site offline with a 500 error.
- Avoid stacking rules that redirect into each other; that creates chains and loops.
- On Nginx servers .htaccess does nothing. Use the Nginx rules shown by the URL rewriter, or your host’s settings.
Common redirect setups
- Moving one page: a 301 from the old path to the new address.
- Switching to HTTPS: the "Force HTTPS" rule, after your SSL certificate is installed.
- Picking one main version: www → non-www or the other way round, so search engines see one site, not two.
- Changing domain: "Old domain → new domain" keeps every path, so old links still land on the right page.
After uploading, test each important old address with the Redirect Checker to make sure there are no chains or loops.
Answers
.htaccess Redirect Generator FAQs
Choose "301 Permanent", enter the old path and new address, then copy the line into your .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.
Usually a mistake in .htaccess. Restore your backup, then add the new rules again carefully.
No. .htaccess is for Apache. The URL rewriter also shows Nginx rules.
Yes, with no sign-up.
Related tools
Continue with these related webmaster tools.
Meta Tag Generator
Free meta tag generator: create your title tag, meta description, robots and canonical tags with a live Google search preview and character counter.
View Page Source
Free page source viewer: see the HTML source code of any website with line numbers, a search filter and tag counts. Works on any device, including phones.
XML Sitemap Generator
Free XML sitemap generator: crawl your website (up to 5,000 pages) or paste a URL list and download a valid sitemap.xml. Leaves out redirects, errors and noindex pages.