To be able to access a local resource as if it were the main site you need to do two things:
Edit your hosts file such that your computer thinks that your domain name is served by localhost. Your hosts file should contain a line with 127.0.0.1 in it and your host name would need to be added to that line, something like: 127.0.0.1 localhost callumstestwebsite.com
Use the command line sudo editor /etc/hosts
to edit this file.
Configure your webserver to serve the website when a request is made for that host name. It appears that you are currently serving the site only when there is a path of /~callum
but you would need to configure the webserver differently. Generally this would entail adding a virtualhost directive something like (for apache server in httpd.conf
):
<VirtualHost *:80>
DocumentRoot /home/callum/public_html
ServerName callumstestwebsite.com
</VirtualHost>
In my Debian based distribution I would create a file called /etc/apache2/sites-available/callumstestwebsite
with that contents (and any other needed configuration), then enable the site with the command: sudo a2ensite callumstestwebsite
, then restart my webserver with sudo service apache2 restart
http://example.com
in local DNS?