If you want name to name mapping, you have to make an entry in your host file with the ip, something like:
192.168.0.5 myfakesite.com
and then you need to have the web server at 192.168.0.5 above answer requests to myfakesite.com by setting up a virtual host for that domain.
This is actually quite a bit of work to go through for just a development site (and you might forget to change it back later). A better answer would be to write your code so it uses relative names for links and includes.
<?php
// instead of writing
echo '<a href="http://mysite.com/some_page.php">';
// you should be writing
echo '<a href="/some_page.php">';
// instead of writing
include('/var/www/html/somefile.php');
include('/var/www/protected/somefile.php');
// you should be writing
include('somefile.php');
include('../protected/somefile.php');
//or even - on Linux
$pwd = trim(`pwd`);
include($pwd.'/somefile.php');
$pwd = rtrim($pwd,basename($pwd));
include($pwd.'somefile.php');
?>
- <?php
-
- // instead of writing
-
- echo '<a href="http://mysite.com/some_page.php">';
-
- // you should be writing
-
- echo '<a href="/some_page.php">';
-
-
-
- // instead of writing
-
- include('/var/www/html/somefile.php');
-
- include('/var/www/protected/somefile.php');
-
- // you should be writing
-
- include('somefile.php');
-
- include('../protected/somefile.php');
-
- //or even - on Linux
-
- $pwd = trim(`pwd`);
-
- include($pwd.'/somefile.php');
-
- $pwd = rtrim($pwd,basename($pwd));
-
- include($pwd.'somefile.php');
-
- ?>
Those are all just examples, but you get the idea.