There are 3 files that are on Denver. The first one is .htaccess, it lies in the root of the site, here are its contents:

RewriteEngine on RewriteRule .* index.php [L] 

As far as I understand, he makes sure that all requests are redirected to the Index.php file. This is actually the index.php file itself, it is also located in the root of the site:

 <?php if($_SERVER['REQUEST_URI'] === '/'){ $page = "home"; } else { $page = substr($_SERVER['REQUEST_URI'], 1); if(!preg_match('/^[A-z0-9]{3,15}$/',$page)){ exit("error url"); } } session_start(); if(file_exists("all/$page.php")) include_once ("all/$page.php"); elseif($_SESSION['ulogin'] === 1 and file_exists( "auth/$page.php")) include_once ("auth/$page.php"); elseif($_SESSION['ulogin'] !==1 and file_exists( "guest/$page.php")) include_once ("guest/$page.php"); else exit("Страница 404"); function top( $title ){ echo ' <!DOCTYPE html> <html> <head> <meta charset=UTF-8> <title>'.$title.'</title> <link rel="stylesheet" href="style.css" type="text\css"> </head> <body> <div class = "wrapper"> <div class = "menu"> Меню </div> <div class = "content"> Контент </div> </div>'; } function bottom(){ echo "</body> </html>"; } ?> 

It checks whether the user is authorized and, depending on this, other pages are connected, or rather their contents. In this case, in the address bar of the browser I write the following: hostname.com/login, as expected, the login.php file is included, here is its contents, it lies in the guest folder, which is in the root of the site:

 <?php top("Страница входа"); bottom(); ?> 

Everything is elementary, but styles are not drawn up to the page, the file with styles is also in the root of the site. I tried to put inline styles, they work. If you look at the source of the page in the browser and try to open the file with the styles, it does not open. Problem in .htaccess file?

  • All the code was created for informational purposes only, I am trying to master php, the fact is that the person whose video lessons I watched is plowing everything ... - Alexey Vladimirovich

2 answers 2

Between your two lines in .htaccess insert these lines:

  RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d 

You just have existing files for processing too * get

  • Earned, thank you so much! I will now that smoking is written in the .htaccess file) Thanks again. - Alexey Vladimirovich
  • one
    Yes, not at all. Just in case, let me explain what these two lines do: they say that requests for real-life files and directories do not need to be processed by mod_rewrite. For everything else there is -MasterCard- index. * - Andrey Pilyugin
  • Thank you, I will consider) - Alexey Vladimirovich

Replace this:

<link rel="stylesheet" href="style.css" type="text\css">

On this:

<link rel="stylesheet" href="style.css" type="text/css">

If it doesn't work, add a slash before style.css.

  • Tried, does not help. But thanks anyway. - Alexey Vladimirovich
  • one
    Try deleting the .htaccess file. Most likely the problem lies in it, I’m not very familiar with the experience of filling it, but it seems to me that all requests go to it, in your case I think href is processed like index.php / style.css or something like that, which is not correct and naturally corresponds to the style file path. - Dmitry Goncharov