How to redirect (sub)domain to a certain IP address along with a port?

If you are running a web service (that is run on port 80 by default) on your home network computer accessible from the internet, you can redirect your Namecheap domain to an IP address of the server along with a port.

First of all, check if all requirements are met:

1) A server or workstation hosting the service has a static IP address.
2) A port you would like to forward the domain to is opened on a workstation and router.
3) A workstation has its firewall disabled, or an exception rule is added.
4) A router is configured to forward the request to the local IP address.
5) It is not a gaming, FTP, remote desktop or radio broadcast service. It is not possible to redirect a domain to an IP address of the server that is not running on port 80 by default using this method. In such case, an SRV record should be created in addition to an A record.
6) The domain is pointed to our BasicDNS or PremiumDNS nameservers.

To set up port forwarding (port mapping), perform the following actions:

1. Sign in to your Namecheap account (The Sign In option is available in the header of the page).

2. Select Domain List from the left sidebar and click on the Manage button next to your domain:

3. Navigate to the Advanced DNS tab at the top of the page and find the Host records section:

 4. Click on the Add New Record button (not able to edit Host Records?):

5. Select URL Redirect Record from the drop-down menu for Type, put @ (your bare domain e.g., yourdomain.tld) for Host and use http://ipaddress:port for Value (IP address and port should be replaced with actual values):

Unmasked Redirect will redirect a domain to your IP address and port and display the specifies URL ( in the browser bar, not your domain name.

If the server (you are redirecting the domain to) has X-Frame feature disabled, you may select a Masked Redirect for the client's browser to display your domain name instead of

6. Click on Save All Changes once the setup is completed. It may take up to 30 minutes for the new settings to be accepted.

Should you want to set it for a subdomain, use its name for Host (address for your address.yourdomain.tld, for example):

You might also want to check for conflicting records for the same Host and remove them, if there are any. The records you need to check may be of Unmasked/Masked/Permanent Redirect, A or CNAME record types.

Here is the example of conflicting records:

That's it!

If you have any questions, feel free to contact our Support Team.

102874 times

Need help? We're always here for you.