Answer the question
In order to leave comments, you need to log in
How can I include files using php?
Hello. I send all requests to 1 file for processing home.php. This file contains conditions and so on.
There are folders with other pages and I want these pages to open as a subdomain, i.e. a file located on the main domain as page/info.php opened as info.site.ru . To do this, I set the settings so that requests from subdomains go to the main domain (and from there to the home.php file).
In home.php I check if it's a subdomain, and if so, load the page with include "page/info.php";
The page is loaded, but the rest of the files (pictures, styles, etc.) needed for this page are not.
How can it be solved? Is it possible to somehow specify in htaccess that files from subdomains are loaded, for example, from the main directory? You cannot create a separate subdomain, because. there will be other pages and they need to be managed through the admin panel (self-written).
I don't know if I wrote everything clearly, if you ask anything.
Answer the question
In order to leave comments, you need to log in
I solved the problem like this:
в тег <head> добавляешь <base href="https://site.ru/"> - где site.ru твой основной домен
По идее если ты везде использовал путь относительно (например, <img src="images/logo.png">), то должно все работать правильно!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question