Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The easiest way to achieve what you are asking is by using the <a href="http://www.w3schools.com/tags/tag_base.asp" rel="nofollow">HTML base tag</a> (although there are some drawbacks). This allows you to specify a default URL for all links within a site. In the following example the relative root for the document is <em>http://www.apache.org/</em> so the <em>/images/feather-small.gif</em> would be loaded from <em>http://www.apache.org/images/feather-small.gif</em>.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;base href="http://www.apache.org/" /&gt; &lt;/head&gt; &lt;body&gt; &lt;img src="/images/feather-small.gif" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>For your sites you would need each site to contain slightly different base tags like:</p> <pre><code>&lt;base href="http://localhost/sites/cats/" /&gt; &lt;base href="http://localhost/sites/dogs/" /&gt; </code></pre> <p>I would imagine if you had lots of sites this could get pretty tedious (especially if you wanted to swap the sites about). One option is to configure the base tag for each site in one place and then incorporate this using something like server side includes (mod_include). Assuming your sites are static content hosted on Apache you could use mod_include could to provide the dynamic base tag includes. Alternatively if your sites were dynamically scripting using PHP, ASP, JSP (or similar) you could acquire or generate the base tag using those technologies. </p> <p>If you created a <strong>basetag.txt</strong> containing:</p> <pre><code>&lt;base href="http://localhost/sites/cats/" /&gt; </code></pre> <p>you could reference this in your static content, e.g. <strong>index.html</strong> might contain:</p> <pre><code>&lt;!--#include virtual="./basetag.txt" --&gt; </code></pre> <p>Then if you needed to move the site to say "<em>felines</em>" you would only need to edit the one file <strong>basetag.txt</strong>.</p> <p>I hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload