How to Redirect a Domain without Changing the URL?

  1. Login to cPanel and go to File Manager.
  2. On the top right side under File Manager, click Settings and check "Show Hidden Files (dotfiles)" and Save.

    Note: This must be enabled for you to check the .htaccess which must be edited in order to complete the task.

  3. Go to public_html folder and search for .htaccess file.
  4. To edit the .htaccess file, press right click on your mouse on index.php file and click Edit and click Edit once the loading process is done. 
  5. Add this code to your .htaccess file.

    RewriteCond %{HTTP_HOST} ^DomainA.com
    RewriteRule ^(.*) http://DomainB.com/$1 [P]

  6. Click Save to override the current code and save the changes you've made.
  7. To check if it's working, clear your browser cache and history or use the incognito mode on your browser.
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

What is a subdomain?

A subdomain is a subsection of a main domain, in this format: subdomain.maindomain.com Sub...

How do I create a subdomain?

Login to cPanel. Locate and click on the "Subdomains" icon under the "Domains" category....

Enable or disable subdomain redirection

To enable or disable redirection of a subdomain, perform the following steps: Click...

How to remove a subdomain?

To remove an existing subdomain, perform the following steps: Click the Remove link...

How to modify a subdomain?

Modify the document root for a subdomain To modify the document root for a subdomain, perform...