How do I set the root directory of an html page?

I am in the following directory on my server:

The components are in .phtml files, but the extension is removed by htaccess rules.

Now I want to go to another .phtml file, but then I have to write this:

<a href="../other-page/"></a>

      

I noticed that I can just do this:

<a href="/other-page/"></a>

      

But then it won't go to http://example.nl/cms/other-page/ as I want, but http://example.nl/other-page/

How do I change the document root to "cms"

so that I only need to use one "/"

?

+3


source to share


1 answer


Here's what you need. You need to set the meta tag based on :

<html>
  <head>
    <base href="http://example.nl/cms/">
  </head>
  <body>
    <a href="/other-page/">click me</a>
  </body>
</html>

      



And then the browser knows that with the help /other-page/

you want to link to /cmd/other-page/

.

This is supported in all browsers , as you can see.

+2


source







All Articles