Domain Forwarding Vs Htaccess
The redirect command and the mod rewrite mechanism.
Domain forwarding vs htaccess. This article will explain how to redirect your domain using a htaccess file using common redirect rules htaccess is a configuration file for use on web servers running the apache web server software. This rule is designed to forward someone from an old domain that is being phased out to a new domain. How to redirect all pages to another domain using htaccess.
Use a 301 redirect htaccess to point an entire site to a different url on a permanent basis. Using this method you can set a specific page to point to an ip address. Via the htaccess file you can set any viable option for domain forwarding except for domain masking.
Go into cpanel and add the old domain. Placing the rule on the remote site will only redirect page requests on the remote domain. Set the nameservers of the old domain to somewhere you have cpanel hosting.
So domain forwarding simply isn t the right solution. Using redirect in an htaccess file enables you to redirect users from an old page to a new page without having to keep the old page. So this should just be a one way rule.
Add a htaccess file that 301 redirects all the internal pages to the new domain. You can also redirect an entire website to another and even exclude single or multiple pages. Even the forwarding command actually sends a forwarding message to the browser telling them what other url to look for.
For example if you use index html as your index file and then later rename index html to home html you could set up a redirect to send users from index html to home html. Simply change our domain name to be yours see the script on github here. We included the following code in the htaccess file used for the original hosting account to point to the new domain and enforce the secure www version which is how we want the new domain to display.