Redirect to a domain and to show it in address bar
I'm very new to url redirect so I'm probably going to ask something very dumb. Sorry in advance, I rather ask you than put myself in a ridiculous situation at school ;)
I'm accesing my web using this url: http://subdomain.myserver.com/folder/index.php
Now I've been asked the following:
if a user writes in the address bar: www.whatever.com my web contents (http://subdomain.myserver.com/folder/index.php) have to load, and also www.whatever.com has to show in the address bar.
(Please note that it's all legal, both web spaces have been purchased.)
In order to do what they ask me I thought in detecting the host www.whatever.com and redirect to subdomain.myserver.com/folder/index.php but that won't show www.whatever.com in the address bar, will it?
I guess I'm missing something like dns or something similar. Can you please guide me here?
Thanks a lot!
Hey if you just redirect to the other page it will show the URL which you redirect to. You simply need to add an DNS record to the domain with the IP of the subdomain.myserver.com/folder/index.php server. Hope this helps :)
You can do this using frame based forwarding, which some hosting providers will offer. If not, create a single index.html in the whatever.com host as follows (edit src url).
<html> <head><title>Insert Title Here</title></head> <frameset rows="0" frameborder="NO" border="0" framespacing="0"> <frame name="mainframe" src="http://your.subdomain.here" scrolling="AUTO" marginwidth="0" marginheight="0" frameborder="NO"> </frameset> <noframes><body bgcolor="#FFFFFF" text="#000000"></body></noframes> </html>
It's best to only use this as a temporary measure, until you can point the domain at the intended server. The solution isn't ideal, and won't work well with search engines.
You need to change your server to route requests for www.whatever.com to the right website (I'm assuming from your use of sub-domains the server is hosting more than one website)
Then you need to change the DNS of www.whatever.com to point to your server.
Exactly how you do this depends on the systems you are using.