It sounds like you're running a local web server. Excellent.
In your Mac's filesystem, there is a file called /etc/hosts
. You can redirect all requests for fooCDN.com
to your local machine by adding this line in /etc/hosts
:
127.0.0.1 foocdn.com www.foocdn.com
You will need root (super user) permissions to edit /etc/hosts
.
The above line means that fooCDN.com
will load from your own computer, where a web server is listening.
You didn't specify what web server you're running locally, though. Following the web server's documentation, you should create a virtual host that points the document root of fooCDN.com
to /Users/name/Desktop/
.
This is a sample configuration (I haven't tested it myself) you can try to use with Apache:
<VirtualHost 127.0.0.1:80>
ServerName foocdn.com
ServerAlias www.foocdn.com
DocumentRoot /Users/name/Desktop
</VirtualHost>
Here's a sample configuration for Nginx (also untested):
server {
listen 80;
root /Users/name/Desktop;
server_name foocdn.com;
}
Don't forget to restart the you web server service or reload the new configuration file.