Forwarding a domain or subdomain to an outside website URL.

There isn't any specific function to forward domains out of the system.  However, there is a workaround that you can use to push a domain or wildcard subdomain out of our websites to a URL or outside of SaleCore.

First, create the site like you normally would and add the domain that is already pointed to SaleCore websites.
Then edit the draft and go to the Website Options and down to the Head HTML field.
In App15
then to:
NOTE: in App20, this is available in the website manager so you don't need to edit draft, but
In the Head HTML field, you will add this code:
<script type="text/javascript">
if(location.hostname.toLowerCase() == ''){
location.href = ''

You will change the bolded text to your own domain/subdomain and URL.  It is important to note that we are using all lowercase in the subdomain to make sure we compare the same case as javascript is case-sensitive.


For example, this is an actual block where we took out the returns to keep it on one line:

<script type="text/javascript">if(location.hostname.toLowerCase() == ''){location.href = ''}</script> 

Just add this block to the beginning of the code that is probably already in there.  Don't remove the other code, just in case you want to use the current site, you can just delete this block and allow the site to function normally.  Once you have done this, you can publish the draft and the site should forward to the location you want.


NOTE: If you know a little javascript and want to know why we aren't just doing a forward and why the "if" statement, is that this block will render in the editor, so you need to check the host to make sure the code is not running if is in the editor by comparing the hostname.






Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.