Redirect a Domain to Another Domain
Point the old domain at the new one with a 301 so browsers and search engines treat the move as permanent. Use registrar forwarding, the cPanel Redirects tool, a Cloudflare redirect rule, or an .htaccess RewriteRule. Match the path as well as the domain, or every deep link lands on the home page.
For site owners moving a domain permanently without losing paths, rankings or mail.
knowledge
- Read time
- 5 min
- Sections
- 6
- Updated
- 14 Nov 2026
- Written by
- WebJi® team
Last editorial update: 15 November 2026.
301, 302 or masked: what each redirect code does
Use a 301 when the move is permanent: browsers and search engines treat the new URL as the real one, and most ranking signals pass across. The other codes exist for narrower jobs.
| Code or mode | Means | Use it when |
|---|---|---|
| 301 | Moved permanently | A brand move or a merge; search engines pass most signals to the new URL |
| 302 | Found, temporary | A campaign or maintenance page; the old URL stays canonical |
| 307 | Temporary, method preserved | A form POST that must stay a POST during a short move |
| 308 | Permanent, method preserved | The same as 307 but permanent; rare outside APIs |
| Masked / framed | Iframe with the old address in the bar | Almost never: two URLs show the same content and signals split |
The only common mistake after that choice is sending every old URL to the home page, which is covered further down.
Four ways to redirect a domain, and which one to use
Pick the method by where the old domain's DNS and site already live — all four deliver a 301, but they differ in who applies it and how much you control. The basics of names and addresses are in URL vs domain name if the vocabulary is new.
| Method | Where it runs | Keeps the path | Best for |
|---|---|---|---|
| Registrar forwarding | At the registrar | Sometimes, as an option | A domain with no hosting of its own |
| cPanel Redirects | On the hosting account | With the wildcard option | A site that already lives in cPanel |
| Cloudflare rule | At the edge, before the server | Yes, by expression | DNS on Cloudflare, no origin server needed |
| .htaccess | On the Apache or LiteSpeed server | Yes, with $1 | Full control of every rule |
DNS itself cannot send a 301. An A record or CNAME only tells the browser where to look; the redirect is an HTTP response from a server — that is why a "DNS redirect" is really forwarding done by the DNS provider's proxy, or a rule at the edge. The same distinction is explained in A record vs CNAME.
Registrar forwarding, step by step
Registrar forwarding is the shortest route and the right one when the old domain has no hosting attached: the registrar itself answers the request and returns the 301.
- Sign in at the registrar that holds the old domain, not the host of the new site.
- Open the domain, then the DNS or forwarding section; in most panels it sits next to the DNS records.
- Add a forwarding entry with the full destination, including https:// and the path if you want a specific page.
- Choose permanent (301), not temporary, and leave masking off.
- Add a second entry for the www hostname if the panel does not do it automatically, then save.
You know it worked when a request to the old domain returns a 301 with a Location header pointing at the new domain; the test command is in the last section. Domains registered or transferred through WebJi®'s domain registration in India can use this route directly.
Carry the path with an .htaccess rule
When every URL on the old domain must land on the same path on the new one, write the rule yourself in .htaccess — the $1 back-reference is what keeps the path and query string.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.com$ [NC]
RewriteRule ^(.*)$ https://new-domain.com/$1 [R=301,L]
- Open File Manager, enable hidden files, and edit .htaccess in the document root of the old domain.
- Add
RewriteEngine Onfirst, once, if it is not already there. - Add the condition and rule above, then save.
- Request an old URL and check that the Location header keeps the path.
- Delete any older Redirect line for the same domain, or the two rules fight and produce a loop.
For a single page, the shorter form is enough: Redirect 301 /old-page/ https://new-domain.com/new-page/. It does not carry query strings, which is fine for a brochure page and wrong for a shop. WebJi®'s cPanel hosting (₹297 a month before 18% GST, a separate product from the Linux shared plans) exposes the same rules through its Redirects screen.
Point each old URL at its new page
A domain move is a list of URLs, not one URL: the old home page goes to the new home page, and every page with links or rankings goes to its closest equivalent.
- Export: the old sitemap and the top landing pages from Search Console or analytics
- Map: two columns — old path, new path — in a spreadsheet before touching any rule
- Batch: redirect section by section where structures match, then handle exceptions one line at a time
- 404 honestly: leave a 404 for pages with no equivalent rather than sending them to the home page, which search engines treat as a soft 404
- Keep the map for a year: old links keep arriving long after launch
The same applies to the www and non-www forms, and to http versus https: pick one canonical host and redirect the other three forms to it, or you run four copies of the same site. The http vs https comparison explains why the certificate comes first on the destination.
What happens to rankings, links and mail
A 301 passes most of the signal from the old URL to the new one, and search engines usually swap the result within days to weeks — but not everything, and not instantly, so a move always carries a short dip.
- Keep the old domain registered and redirecting for at least a year, longer if it still has backlinks.
- Update internal links, the sitemap and canonical tags on the new site so they point at the new domain only.
- Submit the new sitemap in Search Console and use the change-of-address tool where it is offered.
- Redirect mail separately: a domain redirect does not move MX records, so an old mailbox stops receiving unless you keep the mail service or forward the addresses.
That last point catches people mid-move: the website redirects, the invoices still go to an address on the old domain, and nobody notices until a supplier bounces. If the old domain's DNS sits with another provider, changing nameservers is the step after the redirect works, not before.
When the redirect loops or drops the path
Test the response before telling anyone the move is done: one curl command shows the status and the target from any laptop.
curl -I https://old-domain.com/any-page/
- The first line should say
301, not 200 or 302. - The Location header should name the new domain and the same path, not the new home page.
- Run the same command on http:// and on www. to confirm all four forms land in one place.
- If the first line says 301 but Location points back at the old domain, you have a loop — remove the duplicate rule.
ERR_TOO_MANY_REDIRECTS is almost always one of three things: an HTTPS rule pointing back at http, a www rule and a non-www rule chasing each other, or a redirect that rewrites the destination as well as the source. A redirect that drops the path is usually the single-page Redirect line where the RewriteRule block was needed.
Frequently asked questions
Should I use a 301 or 302 redirect?
301 when the move is permanent, which is almost every brand or domain change. A 302 tells search engines the old URL is still canonical, so it fits a campaign or a maintenance page. Use 307 or 308 only when a form submission must keep its HTTP method.
How do I redirect without losing SEO ranking?
Map each old URL to its closest new page instead of sending everything to the home page, use 301, keep the old domain registered and redirecting for at least a year, and update internal links and canonicals on the new site. Expect a short dip while search engines process the change.
How do I redirect specific pages, not just the homepage?
Write a rule that carries the path. In .htaccess that is RewriteRule ^(.*)$ https://new-domain.com/$1 [R=301,L] after a hostname condition. For a handful of pages, one Redirect 301 line per old path is clearer, but those lines do not carry query strings.
Can I redirect a domain without hosting it?
Yes. Registrar forwarding answers the request at the registrar, and a Cloudflare redirect rule works with a proxied placeholder record and no origin server at all. DNS alone cannot send a 301, so one of those two services has to answer the request.
How long should old-domain redirects stay live?
At least a year, and longer if the old domain still has backlinks or printed material in circulation. Keep the registration renewed while the redirect is live, because an expired domain stops answering and the redirect dies with it.
Last editorial update: 15 November 2026. Prices follow the dated sources on this page; checkout confirms current charges.
Ready to get started with WebJi®?
Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.