Free · live registry data · no login
Redirect Rule Generator (.htaccess / Nginx)
Rules to redirect old domain to new.
How it works
Generate .htaccess and Nginx redirect rules that actually work
Pick the redirect you need (www to non-www, http to https, an old page to a new one, or a whole domain move), enter the names, and get copy-paste rules for Apache .htaccess and Nginx, with the right status code and a note on what each line does. Before you paste anything we probe the live site to show where http://yourdomain currently lands, so you can see whether the redirect is already in place, loops, or is missing. 301s preserve SEO when done right; this gets them right.
Results appear here after you click Generate rules.
How this works
- 1
Build the rule
Your domain and target are escaped and dropped into tested Apache mod_rewrite and Nginx templates with the status code you chose.
- 2
Probe the live site
We fetch http://yourdomain from our server and show the redirect chain and web server so you know where the rule belongs.
- 3
Explain and test
Each line is explained in plain words with curl commands to verify the redirect before search engines see it.
Frequently asked questions
- Should I redirect www to non-www or the other way round?
- Either is fine for SEO as long as you pick one and redirect the other with a 301. Bare domains are shorter and more modern; www makes some DNS setups (CNAME to a host) easier. Whatever your site uses today in canonical tags is the one to keep.
- What is the difference between a 301 and a 302 redirect?
- A 301 says the move is permanent: browsers cache it and search engines transfer rankings to the new URL. A 302 is temporary, is not cached and keeps the old URL indexed. Use 302 while testing, then switch to 301.
- Why does my .htaccess redirect not work?
- Usually mod_rewrite is disabled or AllowOverride is set to None on the server, the file is not in the site root, or the server is Nginx, which ignores .htaccess entirely. Our live probe shows the server header so you know which config applies.
- Can I redirect a domain without hosting?
- A redirect needs something to answer HTTP requests. If you have no server, point the domain's DNS at a redirect service or at the hosting of the destination site and add the rule there. Many registrars, including MailShrine, offer simple domain forwarding for this.
- Will redirecting my old domain to the new one keep my Google rankings?
- Mostly yes, if every old URL redirects to its exact equivalent with a 301, the old domain stays registered, and you submit a Change of Address in Search Console. Expect a few weeks of fluctuation while Google recrawls.
Every MailShrine domain includes WHOIS privacy, transfer lock, Anycast DNS with DNSSEC and two business mailboxes.