Redirect Site to Page

Many hosting providers provide a mechanism to redirect from one domain to another, but what if you want to redirect the domain to a page on another website?

If you want to see this in action, visit http://www.powertapping.com.

Scenario

You want to redirect www.myothersite.com to www.mysite.com/otherpage.html

Solution

  1. Create a subdomain on mysite.com (such as “myothersite.mysite.com”)

    For example:

    • Open cPanel.
    • Find the Domains section.
    • Click on Subdomains.
    • Enter “myothersite” in the Subdomain field.
    • Choose “mysite.com” from the Domains dropdown.
    • Enter a document root (such as “/public_html/myothersite.com”) refer to any existing subdomains for the proper directory structure.
    • Click Create.
  2. On the subdomain (myothersite.mysite.com), create a .htaccess file in the domain root directory with the following lines:

    • RewriteEngine On
    • RewriteRule (.*) http://www.mysite.com/otherpage.html [R=301,L]

    To test the set up, point your browser to http://othersite.mysite.com and confirm that it redirects to http://www.mysite.com/otherpage.html.

  3. Use your hosting provider tools to redirect myothersite.com to myothersite.mysite.com

    For example if your domain is managed by GoDaddy:

    • Login to GoDaddy.
    • Click on your name and choose Manage Domains from the Quick Links.
    • Click on “myothersite.com” from the list of domains.
    • Scroll down to Additional Settings and click on Manage DNS.
    • Scroll down to Forwarding and click on either “Add” or the pencil icon.
    • Select “http://” from the drop down.
    • Enter “myothersite.mysite.com” in text box.
    • Under Forward Type select Permanent (301).
    • Under Settings select Forward only.
    • Click Save.

IMPORTANT NOTE: It usually takes several hours for the changes in Step 3 to propogate throughout the domain name network. Periodically point your browser to http://www.myothersite.com to test whether it properly redirects to http://www.mysite.com/otherpage.html.


Send me reports of any errors or suggestions you have about my DNS pages.


This page is Copyright 2020 Tony Lewis <tlewis@exelana.com>.