It's often a problem to develop web applications that are completely relocatable when reusing common template parts. You can now use the WEBAPP:ROOTURL template value ID which will be automatically substituted by the root URL of the web application. You typically use this in the base HTML tag and then write all the URLs in the templates as relative URLs according to the root directory of the web application, like this:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<base href="[!V 'WEBAPP:ROOTURL'/]" />
<title>The title</title>
<link rel="stylesheet" type="text/css" href="style/pub.css" />
</head>
<body><img src="images/rife-logo.png" width="251" height="105" border="0" alt="RIFE logo" /></body>
</html>
More information about the HTML base element can be found on the w3c site
.