Example:
I have a domain name on Godaddy, www.example.com, which I want to forward with masking to 200.200.200.200 which is a server hosted on amazon ec2. When I go to www.example.com through my browser, I see my site just fine. But all the links on my site link to 200.200.200.200/home. How do I make the links point to www.example.com/home instead? I'm using django as my web framework. Thanks!
edit:
an example of the linking I'm using is <a href="{% url home %}">home</a>
so this gets rendered as <a href="/home/" >home</a>
Are you sure you need to use masking instead of forwarding? With forwarded urls this does not happen, but I guess since masking just sticks a new url in the address bar while actually referencing the original page, any relative links still refer to the original url. In addition, I understand that using masking changes the way Google's crawlers behave, so your site might not show up as high as it should in search results, which is something to look into if that is important to you. If for whatever reason you do need masking, I think you'll have to use absolute urls in all your links (it's possible there's some setting in GoDaddy to avoid this, but I have no idea - if there is, hopefully someone else will answer).
The easiest way to use absolute urls in django is probably to define a ROOT_URL variable (i.e. ROOT_URL = http://www.example.com
) in settings.py. Then your home link would be:
<a href="{{ ROOT_URL }}{% url home %}">home</a>
You'll also need to pass 'ROOT_URL'=settings.ROOT_URL
to the view's HtmlResponse (or pass a context_instance instead) so that the template has access to the ROOT_URL variable.
Hope that helps!