V
V
Vlad_isLove2018-06-08 00:47:36
PHP
Vlad_isLove, 2018-06-08 00:47:36

How do you make a single point of entry on the site?

I'm trying to make a single entry point on the site, but it doesn't work, everything works crookedly. When a file is included in index.php, links to css and img are not correctly displayed on the loaded page, which for some reason change their address depending on the url. I don't understand what's wrong with me. Maybe someone will throw off the scripts for splitting the url into parts and following it from their projects. And a .htaccess file wouldn't hurt either. So that I know if I'm doing everything right. And how do others implement the entry point. There are almost no scripts on the Internet.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey delphinpro, 2018-06-08
@Vlad_isLove

which for some reason change their address depending on the url. I don't understand what's wrong with me.

Everything is like that with you.
There are two solutions
1. Specify paths to statics from the root of the web server:
<link href="/design/css/main.css">
<img src="/design/images/logo.png">

2. Use a tag<base>
<base href="http://my-super-site.ru/">
<link href="design/css/main.css">
<img src="design/images/logo.png">

M
McBernar, 2018-06-08
@McBernar

You should start with the fundamentals - filesystem paths, the MVC pattern, and the front controller.

I
index0h, 2018-06-08
@index0h

Use symfony luke.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question