How do I redirect one domain to another domain name? Print

  • 0

Domain name redirection is possible in two ways, elaborated as below:

PHP and HTML redirects

If you do not wish to use the .htaccess file to redirect your visitors, you can use another option – a PHP or an HTML file which will perform the actual redirection. Below are examples for both programming languages:

For PHP, create a file (index.php for example) and add the following lines in it:

header( ‘Location:’ ) ;

For HTML, create a file (index.html for example) with the following content:


Here you have the option to delay the redirect by increasing the CONTENT variable. For example CONTENT=5 will delay the redirect for 5 seconds.

Creating different types of web redirect with my cPanel?
You can create different types of web redirects from your cPanel > Redirects in the Domains box. The redirection can be Temporary and Permanent.

Temporary redirects (as the name suggests) are not permanent redirects, which means that the page is sending status code 302 to the browser. The 302 code tells the browser not to save this redirect into its cached data. This is the recommended type of redirect unless you are absolutely sure that you will never change it in the future.

Permanent redirects have a status code of 301 and unlike the temporal ones are cached in the browser memory. 301 redirects are permanent. They mean that the page has moved and they request any search engine or user agent coming to the page to update the URL in their database.

Sometimes the above redirects may loop and show errors. In such cases we recommend plain HTML or PHP redirects.

You can also use a redirect through WSP (website panel) by going to your Website – there you will see your website pointing to a folder. You can also point it to redirect to another location. It will automatically take care of the rest.

Was this answer helpful?

« Back