I am trying to setup a test server to build websites in. I am using Ubuntu 14.04 with the public_html directory for each of my sites. So when I create a new site, I build a new user on the server and it creates all the necessary items for me (I also use the users directory to store information about that site as well) and I build the site in the public_html directory. To visit that site I go to http://testserver/~username
. When I publish the site, it will be moved to a proper web server.
This works great, but when building the site in the public_html directory, all my absolute links must show as
<a href="/~username/page.php">Link</a>
How can I change it so that I can just make a normal absolute link, i.e.
<a href="/page.php">Link</a>
and have it go to the proper page - testserver/~username/page.php
?
I can use relative links as a work around, but I prefer using absolute links in my sites.
You can't there part of the Browsers systems
http://
orhttps://
mean it's a fully qualified URL/
means from the root of the domain../
orpages/
relative to the current path of the URLWhat i do is setup more subdomains
setup ~username.testserver/ and use each user as a domain. if you have an actual domain you can use the * as an A Record so that you dont have this problem