[-] FO : do not use dispatcher routes for static files
This commit is contained in:
1 parent
e827d3355d
commit
35d3d1d6c5
1 file changed
+4
-1
@@ -676,6 +676,9 @@ class DispatcherCore
|
|||||||
return strtolower($this->controller_not_found);
|
return strtolower($this->controller_not_found);
|
||||||
$controller = $this->controller_not_found;
|
$controller = $this->controller_not_found;
|
||||||
|
|
||||||
|
// If the request_uri matches a static file, then there is no need to check the routes, we keep "controller_not_found" (a static file should not go through the dispatcher)
|
||||||
|
if (!preg_match('/\.(gif|jpe?g|png|css|js|ico)$/i', $this->request_uri))
|
||||||
|
{
|
||||||
// Add empty route as last route to prevent this greedy regexp to match request uri before right time
|
// Add empty route as last route to prevent this greedy regexp to match request uri before right time
|
||||||
if ($this->empty_route)
|
if ($this->empty_route)
|
||||||
$this->addRoute($this->empty_route['routeID'], $this->empty_route['rule'], $this->empty_route['controller'], Context::getContext()->language->id);
|
$this->addRoute($this->empty_route['routeID'], $this->empty_route['rule'], $this->empty_route['controller'], Context::getContext()->language->id);
|
||||||
@@ -706,7 +709,7 @@ class DispatcherCore
|
|||||||
$this->front_controller = self::FC_MODULE;
|
$this->front_controller = self::FC_MODULE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($controller == 'index' || $this->request_uri == '/index.php')
|
if ($controller == 'index' || $this->request_uri == '/index.php')
|
||||||
$controller = $this->default_controller;
|
$controller = $this->default_controller;
|
||||||
$this->controller = $controller;
|
$this->controller = $controller;
|
||||||
|
|||||||
Reference in new issue
Block a user