A redirect automatically sends the visitor (and search engines) from one address to another. You need one when you change a page's address, when you rebuild the website with a different structure, or when you have several domains that should lead to the same website. 301 means “moved permanently”: Google transfers the old page's ranking to the new one. 302 means “moved temporarily”.
What you'll achieve
- send a whole domain to another one, from the website's “Redirects” page;
- send old pages to the new ones, with rules in
.htaccess; - check that the redirect works and doesn't create a loop.
Before you start
- For
https://and for the version with or withoutwww, don't use this page: use “Force https” and the rule from Redirect to HTTPS and www. - Make a list: the old address and the new address, for each page.
- Log in to Enhance at https://server.nbt-host.com. We use the English names, exactly as they appear on screen.
The steps
A. A whole domain to another one (from Enhance)
Example: you also have domeniul-tau.com as an alias of the website, and you want all its visitors to end up on domeniul-tau.ro.
- In Enhance, go to “Websites” » the website. Open the “Redirects” tab (on a narrower screen, it's in the “Advanced” menu).
- Click “Add redirect”.
- For the type, leave 301 (permanent). Choose 302 only for something temporary, such as a campaign page.
- For the domain, choose only the alias (
domeniul-tau.com), not “All domains” and not the main domain. - Leave the field after
/empty, so it applies to the whole domain. - For the destination, after
https://, enterdomeniul-tau.ro, with no/at the end. - Click “Add”. The requested page is kept: anyone who opens
domeniul-tau.com/contactlands ondomeniul-tau.ro/contact.
If Enhance shows “Redirect loop”, the redirect would send the domain to itself: click “Cancel” and choose only the alias.
B. An old page to a new one (in .htaccess)
For page addresses, the safest option is one rule per page in .htaccess:
- On the website's page, go to the “Files” tab »
public_html, right-click.htaccess» “Edit”. If the file doesn't exist, create it with “New” » “File”. - Add the lines at the top of the file, one for each page: the old address without the domain, then the full new address.
Redirect 301 /despre-noi.html https://domeniul-tau.ro/despre
Redirect 301 /servicii/vechi https://domeniul-tau.ro/servicii- Save, then open the old address in a private window: you should land on the new one.
Good to know:
- write the old address starting with
/and without the domain; write the new address in full, withhttps://; Redirectalso sends everything “under” the old address:/servicii/vechi/cevalands on/servicii/ceva;- in WordPress, put the lines above the
# BEGIN WordPressblock, not inside it, so WordPress doesn't delete them. You can also use a redirect plugin, but don't add the same redirects in both places.
C. Check
Open each old address in a private window or in a redirect checker (for example httpstatus.io). You should see a single hop, with a 301 code, to the new address, which responds with 200.
If something doesn't work
- The browser says “too many redirects”. Two rules conflict. See “Too many redirects”: how to stop the loop.
- The redirect doesn't apply. Your browser remembered the old version: try a private window. With
.htaccess, check the spelling and that the lines come before any other rules that match the same address. - The website shows a 500 error after you edited
.htaccess. A typo stops the whole file from working. Delete the lines you added and add them again, carefully (see Error 500 Internal Server Error and the blank page). - A new domain doesn't redirect. The domain must first be added in Enhance (as an alias) and point to our server (see Subdomains and additional domains in Enhance).
