Here are the step-by-step instructions:
- Create the forwarding site. If you are going to forward to www.example.com or your-site.some-other-web-host.com, try to give it a short name like examplefwd.
- Set up the name you want to forward from as an alias of the examplefwd site.
- Create a one-line plain text file on your local computer called htaccess.txt
containing the following (replacing www.example.com with the name of the site you want to forward
to):
RedirectPermanent / https://www.example.com/
or (if appropriate)
RedirectPermanent / https://www.example.com/your/custom/path/
- Upload this htaccess.txt file to your examplefwd site hosted here as a text file.
- Rename the file from htaccess.txt to .htaccess. (That's "htaccess" with a period in front.)
This approach works for all sorts of URLs, not just the main site. For example, if you use this technique to forward members.example.com visitors to www.example.com/members/ and someone visits https://members.example.com/page.html they will be forwarded to https://www.example.com/members/page.html.
Please note if the target site is hosted here and you merely want to redirect alternative names, setting a hard canonical name is usually faster, easier, and cheaper than this approach. This approach is better suited when the redirection involves two hosts or path manipulation at either or both ends.