Reputation: 4183
I am hosting a web site from home. My system has two layers: a web server (running Ubuntu 11.04) that is port forwarded through port 80 and has only index.php on var/www and an application server (running Ubuntu 11.10) that has everything else and is set up to only talk to the web layer server.
index.php has the following line of code.
<li><a href="192.168.1.4/about.php">About</a></li>
This is a menu item that is supposed to call about.php which is located in var/www on the application server which has the local IP address 192.168.1.4. However, when I click the button associated with this menu item, it tries to access http://localhost/192.168.1.4/about.php and gives the error message
The requested URL /192.168.1.4/about.php was not found on this server.
If I go to the address box and manually delete the http://localhost/ part so the address box simply says 192.168.1.4/about.php then the about.php page on the application server shows up. Subsequently, when I click on a menu button associated with index.php then everything works fine. It seems like it starts by adding http://localhost/ to the specified address until I manually delete it and then it leaves it out by default.
The real problem comes when I try to access my site from another computer. I type in my domain name, say whatever.com, and the index.php page shows up. However when I click on the menu button, it tries to access http://whatever.com/192.168.8.1.4/about.php and gives an error message. When I go to the URL box and manually delete http://whatever.com/, everything works fine. However I do not want the user to have to do this. Also, I am doing this from another computer on my home network so I am not sure what would happen from a remote computer.
What is the best way to get the index.php file to simply use 192.168.1.4/about.php and not localhost/192.168.1.4/about.php, whatever.com/192.168.1.4/about.php etc.
Many thanks in advance,
Peter.
Upvotes: 1
Views: 735
Reputation: 145458
You forgot to add scheme in the URL. Use:
<li><a href="http://192.168.1.4/about.php">About</a></li>
or:
<li><a href="//192.168.1.4/about.php">About</a></li>
Upvotes: 3