Is this possible to set up in the dns register other than the web hosting? [closed]

Is this possible to set up in the dns register other than the web hosting? [closed] - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Is this possible to set up in the dns register other than the web hosting? [closed] error on your web browser. Problem :






My domain is hosted in a domain name registry cloudflare and the website is hosted in the shopify. We have QR code tagged with each product selling in the shopify. If a customer scan it it will go to mydomain.com?specialCode=123456 and he/she could win a prize. Recently we've developed the sns application on different sub domain sns.mydomain.com. I want to know if we can set up redirect to go to sns.mydomain.com if the url has specialCode attached. Hopefully I can set up a redirect on the name on the cloudflare so we don't need to redirect from client side since shopify doesn't give you access to the server side. Is this possible?


Example
mydomain.com?specialCode=123456 => sns.mydomain.com/specialcode=1234


Solution :

Cloudflare Page Rules


You can accomplish this using the Page Rules feature. Here is a getting started tutorial by Cloudflare.


What you want to do is map example.com/?parameter1=value1 to subdomain.example.com. The problem is matching the query parameters.


Best route I think is to add a dedicated directory for prizes and use a wildcard. You would just have to create a separate QR code for winners.


mydomain.com/special-prize/* -> sns.mydomain.com/you-lost
mydomain.com/special-prize/w/* -> sns.mydomain.com/you-won

Please be advised wildcards will forward anything after /special-prices/ and /special-prices/w/.


Here's what the Page Rules section looks like:


enter image description here




Checking the prize code in a programmatic way...I think can be done using Query String Sort and you'd need to have an enterprise account. It's designed as a method to control caching so this would be an unorthodox usage to say the least.


You can learn more about that here. You would set up the page rule the same as before just with your winning string in it. I would open a ticket with their technical support.




Without Shopify and CF it would be very simple on a typical server. In Nginx, of the top of my head something like:


location / 
if ($arg_specialCode = true) {
return 301 https://sns.mydomain.com$uri$is_args$args;
}


$is_args is an empty string if there are no arguments, or a ? indicating the start of the query string.


Then $args adds the arguments


$query_string can be used as well, same methodology.


We hope that this article has helped you resolve the redirects, dns, subdomain error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=