In many ways, domain forwarding works like a regular web page redirect. It’s been around for a while, and you are usually presented with multiple different mechanisms for setting it up. Choosing your approach is not a decision you should take lightly, as it can have a not insignificant impact on your website’s performance.
The thing you need to pay attention to the most is the type of redirect being set up. Registrars and hosting providers often let you configure domain forwarding without telling you how exactly they’re redirecting users.
Generally speaking, domain forwarding can involve two types of HTTP redirection:
- 301 redirect – the user’s browser is informed that the content has been moved permanently
- 302 redirect – the server responds with a “found” HTTP response, indicating a temporary redirect
There’s no difference between the two in terms of user experience, but for SEO purposes, it’s essential to ensure your domain forwarding is set up via a 301 redirect. The best way to configure it is to modify the .htaccess file in your hosting account.
First, make sure your domain is pointed to your ScalaHosting account. If you’ve recently modified its DNS settings, you might need to give it up to 48 hours for the changes to propagate throughout the world.
Use an FTP client or your control panel’s File Manager to open the document root folder of your domain (by default, it’s public_html). Modifying the .htaccess file can break your website, so before making any changes to it, it’s important to have a backup, either locally or on the server.
Add the following code to the .htaccess file:
- RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain1.com [NC]
RewriteRule ^(.*)$ https://domain2.com/ [L,R=301,N]
Swap domain1.com for your domain and domain2.com for the domain you want to forward to and save the changes to set up the redirect. If you don’t see it working immediately, you might need to clear your browser’s cache.
You have another option for setting up a redirect for your domain – through your web hosting control panel’s Graphical User Interface. Here, for example, is how it works with SPanel – ScalaHosting’s proprietary management platform.
First, you need to log into SPanel’s User Interface. The default login URL is yourdomain.com/spanel.
Next, you need to click the Redirects icon under the Domains section on SPanel’s homepage.
To set up a redirect, simply pick the type of redirect from the first drop-down menu and enter the source and destination URLs.
If you have any other questions or issues, feel free to get in touch with our technical support experts, who will be happy to assist you further.
How To Point a Domain Name To a Web Hosting Provider