.htaccess & Nginx 301 Redirect Generator
Generate HTTP→HTTPS, www→apex, and bulk old→new URL migration rules simultaneously for Apache .htaccess and Nginx.
Apache (.htaccess)
Nginx (server block)
Frequently Asked Questions
Should I use 301 or 302 redirects during a site migration?
Always use 301 (Permanent Redirect) for permanent URL moves so search engines consolidate canonical signals and backlink equity onto the destination URL.
How do you prevent redirect chains?
Collapse HTTP→HTTPS and www→apex directly into the final canonical URL in a single hop (A → C instead of A → B → C).
Where do Nginx redirect rules go?
Add the generated location / return 301 lines inside the site’s server block in /etc/nginx/sites-available/*.conf, then run nginx -t && systemctl reload nginx.