Prevent URL from switching from domain name to IP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amh1010
Forum Newbie
Posts: 19
Joined: Sat Feb 06, 2010 1:49 pm

Prevent URL from switching from domain name to IP

Post by amh1010 »

My site is hosted on my own machine, but I have a domain name directed at my IP. When a user enters my domain, and goes to my site, the URL switches to my IP and stays. How do I prevent this? Is there some PHP code that would help the problem? Thanks for any help.

EDIT: I'm using GoDaddy and WAMP.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Prevent URL from switching from domain name to IP

Post by Christopher »

What webserver are you using? Apache? My guess is that you do not have the domain name configured so the name of your site is the IP address.
(#10850)
amh1010
Forum Newbie
Posts: 19
Joined: Sat Feb 06, 2010 1:49 pm

Re: Prevent URL from switching from domain name to IP

Post by amh1010 »

Yeah, it's Apache. I've looked for how to make it work on Apache, but to no avail. If you could help, or at least point me in the right direction, that'd be great. I'm running out keywords to search in Google, haha
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Prevent URL from switching from domain name to IP

Post by Christopher »

(#10850)
amh1010
Forum Newbie
Posts: 19
Joined: Sat Feb 06, 2010 1:49 pm

Re: Prevent URL from switching from domain name to IP

Post by amh1010 »

If you mean in my httpd.conf file, it says:

# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName http://www.realtorboss.com:80

#
# DocumentRoot: The directory out of which you will serve your
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Prevent URL from switching from domain name to IP

Post by Christopher »

However your frame is:

Code: Select all

<frameset rows="100%,*" border="0">
  <frame src="http://xxx.xxx.xxx.xxx" frameborder="0" />
  <frame frameborder="0" noresize />
</frameset>
 
And since your links are relative they will take that. You might want to set your server as as subdomain like "ww2.realtorboss.com" or on a different port.
(#10850)
amh1010
Forum Newbie
Posts: 19
Joined: Sat Feb 06, 2010 1:49 pm

Re: Prevent URL from switching from domain name to IP

Post by amh1010 »

If I use frames, won't that still give me a static URL?
Post Reply