Now I have this code somewhere in the core class:

 $routes = explode('/', $_SERVER['REQUEST_URI']); if ( !empty($routes[1]) ) { $controller_name = $routes[1]; } elseif ( !empty($routes[2]) ) { $action_name = $routes[2]; } 

In .htaccess :

 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php [L] 

Then start the controller with the specified name and the method actiion_name . Actually, the question is: how are links from more than two parts processed?
For example /event/today/morning/wakeup .
How is the controller call issued in this case? I'm learning, so I will be grateful if someone explains what's what.

  • modvrayrt redirects all requests to index.php, and then the routing / dispatching module is started, which according to the incoming URL and the matching rules specified to it determines which controller and action is needed. - vitidev
  • @vitidev, Can you elaborate on the dispatch module? Thanks - Vyacheslav Potseluyko
  • one
    the easiest way is to learn any mvc framework in order to understand how it usually works. Take any framework, documentation, section "routing / routes" (you can directly drive Google into the name of the routes framework and see examples of how to set rules. This will give an understanding of how others decide to match the URL with the ultimate goal even without reading someone else's code - vit

0