Pergunta

I have a website made with cakephp. Most of the links in it, and asset paths, are absolute (start with "/").

We're having some problems with our hosting provider and some domains are messed up, including the one for this website. I've managed to access it through another domain, but now the website instead of being on the document root of the domain (as it was with its original domain), it inside a few folders (so something like mydomain.com/folder1/folder2/folder3/my_index.php).

Is there an easy way I can make all those links/paths that now start with "/" point to the folder that I want (for example mydomain.com/folder1/folder2/folder3/) instead of what happens now? (they point to mydomain.com)

Foi útil?

Solução

Yes, you want the <base> HTML tag. Use it like such:

<head>
    <base href="http://mydomain.com/folder1/folder2/folder3/">
</head>

You can also make all your links open in a new window by adding a target="_blank" attribute to the base tag.

MDN Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top