Hello, I make a single entry point (I connect the pages) and I can not implement this. I have this code in the index.php file.

if ( $_SERVER['REQUEST_URI'] == '/' ) { include 'html/main.inc.php'; } else { $page = substr($_SERVER['REQUEST_URI'], 1); $pg = explode('?', $page, 2); if ( file_exists('html/'.$pg['0'].'.inc.php') ) { include 'html/'.$pg['0'].'.inc.php'; } else { if ( $_SERVER['REQUEST_URI'] != 'html/'.$pg['0'].'.inc.php') { include "html/error.inc.php"; } } } 

And I connect the files with this code.

 if ( file_exists('html/'.$pg['0'].'.inc.php') ) { include 'html/'.$pg['0'].'.inc.php'; 

but opens pages of this type site.ru/login

and I want to open from a directory such as site.ru/account/login

  • Make a replacement / on . and at site.ru/account/login will open the html/account.login.inc.php file. - Visman
  • parse_url() to help you in the future - teran

0