Can a CNAME be pointed to a paramterised URL with query params?

Viewed 22

Can a CNAME for gameid123.com be made to point to URLS like:

  1. my_other_website.com/games/gameid123
  2. my_other_website.com/games?nameid=gameid123
  3. my_other_website.com/games/gameid123?gameid=gameid123

So that whenever a user tries to access gameid123.com, it instead opens one of these above urls as its home page.

If the above is not possible, then in what ways do I solve this problem?

A request like gameid123.com/some_api_call/someParam1?blah=blah1 shoul resolve to my_other_website.com/games/gameid123/some_api_call/someParam1?blah=blah1

1 Answers

A CNAME can only point at another host (no paths / queries involved). However, there are a number of ways that you can have an incoming request either redirect (or rewrite) the incoming request.

The solution will depend on whether you want the user to end up on my_other_website (redirect) or if you want all requests to be via gameid123.com (rewrite).

Related