This article describes how to set redirections in the websites hosted on Linux and Windows machines. We will discuss following three cases to set redirection.
- Set redirection through domain control panel (at registrar level)
- Set redirection in Windows Server
- Set redirection in Linux Server
1) Set redirection through domain control panel (at registrar level)
Domain registrars allow you to set up the URL redirects to point your domain/sub-domain to any destination page. The key benefit of this method is that; you do no need to purchase web hosting services for source domain and it will take into effect within minutes. If you wish to take the benefit of this method, you will have to use default nameservers of registrar. At domain registrar, URL redirects can be set via 2 methods.
1.1) Domain forwarding/URL forwarding
With domain forwarding method, your domain visitors will be redirected to the specified destination website automatically. For example; suppose you have set up the domain forwarding from example.com to example.net. Now when your visitors browse your website example.com, they will be automatically redirected to example.net. The real problem with the domain forwarding is that, browser address bar will display the destination domain (i.e. example.net). This problem can be rectified with Domain Masking/Frame Redirect.
1.2) Domain masking/Frame redirect/URL masking
URL Masking/Frame Redirect is another type of domain forwarding method that prevents your visitors from seeing the destination URL in browser address bar by keeping the actual domain name. In simpler words, your vistors will load the destination page while keeping the actual URL in browser's address bar. For Example; if you have set URL masking for domain example.com to examle.net then whenever anyone browses the example.com, they will actually see the content of example.net but the address bar will still display the example.com.
If you have purchased the domain registration services from AccuWebHosting.com, you can raise a support ticket from your client area to set the Domain forwarding. If you have registered your domain to some other registrar, you can contact your registrars to do it for you.
2) Redirection in Windows server/VPS
For Windows based servers, there are mainly three options to set URL redirects.
2.1) Redirection from WebsitePanel
To set redirection from WebsitePanel, you can refer to our knowledgebase article.
2.2) HTTP redirect from IIS
To set redirection from IIS through HTTP redirect method, you can follow our knowledgebase article here.
2.3) Rewrite rules through URL rewrite module
IIS URL rewrite module enables a web admin to create search friendly, easy to remember yet powerful rewrite rules. URL rewrite also allows you to perform redirects, send custom responses, stop HTTP requests according to logic expressed in the rewrite rules. URL rewrite module is available to use as an extension to IIS and can be downloaded from here. To create and test a set of rewrite rules, refer to Microsoft guide here.
3) Redirection in Linux server/VPS
In Linux based hosting, URL redirection can be set either through cPanel Redirects or .htaccess file.
3.1) Domain redirection through cPanel Redirects
Refer to following video tutorial to redirect your domain’s visitors from a source URL to a target URL through cPanel Redirects.
3.2) URL redirect using the .htaccess file
Refer to following guides for more information to create .htaccess redirection rules.