I just realized that our website got impersonated by another website. Our website is website.com and the fake website is websites.com (a “s” is added at the end of our name). Content on the fake website is exactly mirroring our website and all changes on our website are mirrored on the other in real time. It looks like a redirection. I contacted Shopify that is investigating but meanwhile I would like to warn our customers with a little script checking the actual URL and printing a message on the homepage. Please tell me what is wrong with these 2 scripts:
{% assign rh = request.host | string %}
{% assign bad_host = 'www.websites.com' %}
{% if rh == bad_host %}
<div id="alert-impersonnisation" style=" background-color: red; padding: 9em 2em; color:black; font-size: 2em; text-align: center;">
<p> WARNING TEXT.</p>
</div>
{% else %}
{{rh}}
// output:www.websites.com
{{bad_host}}
// output:www.websites.com
{% endif %}
or
{% assign rh = request.host | string %}
{% assign searchs = 's' %}
{% if rh contains searchs %}
<div id="alert-impersonnisation" style=" background-color: red; padding: 9em 2em; color:black; font-size: 2em; text-align: center;">
<p> WARNING TEXT</p>
</div>
{% else %}
{{rh}}
// output:www.websites.com
{% endif %}