I recommend using the HTML <base>
element:
<head>
<base href="http://www.example.com/default/">
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
In this example, the stylesheet is located in http://www.example.com/default/style.css
, the script in http://www.example.com/default/script.js
. The advantage of <base>
over /
is that it is more flexible. Your whole website can be located in a subdirectory of a domain, and you can easily alter the default directory of your website.