Sure, all relative URIs (as yours) are relative to the base URI which by default is the URI of the document:
http://localhost/testsite/index.php
You only need to tell which part to add:
^
` see this dot
Example:
Base URI :: http://localhost/testsite/index.php
Relative URI :: ./css/layout.css
Result :: http://localhost/testsite/css/layout.css
If you need to have this more modular, there are multiple ways to do that. One is to set the base URI explicitly inside the HTML document (see ).
Another one is to resolve links relatively on the server-side based on the Request URI and your site's root-path. See this answer for an example.