.htaccess Redirect Generator
Build Apache redirect rules — HTTPS, www, and custom URL redirects.
Custom redirects
About this tool
Builds an Apache .htaccess file with common redirect rules — force HTTPS, force (or drop) a www. prefix site-wide, and any number of specific old-URL-to-new-URL redirects — using mod_rewrite. Upload the result to your site's root directory (where Apache is the web server).
Everything is generated locally in your browser — nothing is uploaded.
Frequently asked questions
- 301 or 302 — which should I use for a redirect?
- 301 (permanent) tells browsers and search engines the old URL has moved for good — use it when a page has permanently relocated, since it also passes along most of the old page's SEO value. 302 (temporary) is for a short-term redirect you plan to undo, and doesn't transfer SEO value the same way.
- Does this work on Nginx or other web servers?
- No —
.htaccessandmod_rewriteare Apache-specific. For Nginx, use this site's Nginx Config Generator instead, which uses Nginx's ownrewrite/returndirective syntax. - Why doesn't my redirect seem to work after uploading?
- Make sure
mod_rewriteis enabled on your server and that.htaccessfiles are allowed to override rewrite rules (AllowOverridemust includeFileInfoorAllin your server's main config) — this is a server setting this tool can't control.