Y
Y
yagipen2021-12-22 13:38:32
PHP
yagipen, 2021-12-22 13:38:32

How to avoid absolute paths when using templates?

Let's say I have a templates directory that contains the usual layout. But after all, it will be displayed only with an absolute path, which can provide additional information about the structure of the site. For example, instead of assets/css/app.css I would have to use templates/index/assets/css/app.css. Is it possible to use incomplete paths somehow?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Danny Arty, 2021-12-22
@DanArst

Use<base href>

N
nokimaro, 2021-12-22
@nokimaro

Is it possible to use incomplete paths somehow?

It is possible, but not necessary. The value of this information for an outside observer is zero.
And if the "observer" is already inside your server, then he will always look and see anything.
You can solve the problem using rewrite at the web server level.

A
Anton Shamanov, 2021-12-22
@SilenceOfWinter

you can use RewriteRule's in .htaccess

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question