Page 1 of 1

localhost remval

Posted: Mon Apr 12, 2010 11:57 pm
by abhims2
Hi,

I am using XAMPP server to run my PHP code. The link I get to run my website is anything placed in "htdocs" folder along with http://localhost/.....

I would like to remove localhost from my website link. How can I do that?
Mu link looks like this "http://localhost/college_menu/admin/index.html". College_menu is folder inside htdocs folder and admin is sub folder inside college_menu. Please let me know how can I remove localhost frm the link....

Many thanks in advance!!!

Abhilesh

Re: localhost remval

Posted: Tue Apr 13, 2010 1:10 am
by omniuni
You could probably use a relative link.

Other than that, localhost is just the server. As long as your links are relative, then when you upload the website to your host, the links will still work.

Re: localhost remval

Posted: Tue Apr 13, 2010 2:38 am
by abhims2
Thanks a lot...

but I dont know how to make links relative. can you please give me some info on how to do that?

Many thanks!!

abhilesh

Re: localhost remval

Posted: Tue Apr 13, 2010 3:11 am
by omniuni
Relative links are just like moving around in a terminal.

Let's say you have:

-+public_html
|
|- index.php
|- login.php
|-+college_menu
| |
| |- index.php
| |-+admin
| | |
| | |- index.html
| |
| |- college_menu.gif
|
|- header_image.png
|- logout.php

now, let's say I want to get from index.php in college_menu to the admin folder's index.php. Because index.php is the default when entering that folder, I use the link "admin". so <a href="admin">Admin</a>

Let's say I want to exit that folder. I can go up a level using the link <a href="../">Return to Website</a>.

I can return to my localhost index, as well <a href="../../">Return to Localhost</a>

If you later upload college_menu, then your admin link will still work. Only "return to localhost" won't because it is no longer on localhost, a location (up-two-levels) that does not exist in your production environment.