问题
On Google Domains, I own www.example.com
. I also have hosting for free at www.university.com/~myname
.
I want to be able to forward
www.example.com
to www.university.com/~myname
,
but I want the domain to still show as www.example.com
.
I also want
www.example.com/something/something.txt
to forward to
www.university.com/~myname/something/something.txt
,
with the URL still showing www.example.com/something/something.txt
.
How can I do this?
(I know this question exists, but the settings page is very out of date: How to mask the domain forward from Google domains without Google app)
回答1:
This is not possible without having someone standup a webserver that will redirect requests.
Using CNAMEs you can mask www.example.com to www.university.com since this translation is purely based on DNS. The concept of www.university.com/~myname is an HTTP concept of URL paths and you need an HTTP server (aka webserver) to do this redirection.
Look at URL forwarding services (NameCheap offers such a service https://www.namecheap.com/support/knowledgebase/article.aspx/545/51/how-do-i-set-up-url-redirect-when-i-use-your-freedns-service when you use their FreeDNS servers for your DNS). You don't need to move your domain registration to them (you can keep that with Google), just move your NS records to namecheap servers to use their redirection service.
来源:https://stackoverflow.com/questions/47113210/how-to-mask-url-redirect-with-google-domains