diff --git a/admin-dev/themes/default/template/controllers/not_found/content.tpl b/admin-dev/themes/default/template/controllers/not_found/content.tpl
index 67933528c..cd836c0ea 100644
--- a/admin-dev/themes/default/template/controllers/not_found/content.tpl
+++ b/admin-dev/themes/default/template/controllers/not_found/content.tpl
@@ -22,7 +22,9 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
+{if isset($controller) && !empty($controller) && $controller != 'adminnotfound'}
{l s='The controller %s is missing or invalid.' sprintf=$controller}
+{/if}
- {l s='Go to the dashboard.'}
- {l s='Back to the previous page.'}
diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php
index 2eebe37aa..299e6e177 100644
--- a/classes/Dispatcher.php
+++ b/classes/Dispatcher.php
@@ -647,7 +647,8 @@ class DispatcherCore
* @return string
*/
public function getController()
- {
+ {
+ $_GET['controllerUri'] = Tools::getvalue('controller');
if ($this->controller)
{
$_GET['controller'] = $this->controller;
@@ -709,7 +710,9 @@ class DispatcherCore
break;
}
}
- if ($controller == 'index' || $this->request_uri == '/index.php')
+
+ $request_uri = str_replace(str_replace(realpath(dirname(_PS_ADMIN_DIR_)), '', _PS_ADMIN_DIR_).DIRECTORY_SEPARATOR, '', $this->request_uri);
+ if (in_array($controller, array('index', 'adminnotfound')) || in_array($request_uri, array('', 'index', 'index.php')))
$controller = $this->default_controller;
$this->controller = $controller;
}
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index bd413b9d0..ae44cc7b9 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -1100,7 +1100,7 @@ class AdminControllerCore extends Controller
}
else
{
- $this->errors[] = Tools::displayError('The object cannot be loaded (ithe dentifier is missing or invalid)');
+ $this->errors[] = Tools::displayError('The object cannot be loaded (the dentifier is missing or invalid)');
return false;
}
diff --git a/controllers/admin/AdminNotFoundController.php b/controllers/admin/AdminNotFoundController.php
index 00344cd61..d26e92827 100644
--- a/controllers/admin/AdminNotFoundController.php
+++ b/controllers/admin/AdminNotFoundController.php
@@ -39,8 +39,7 @@ class AdminNotFoundControllerCore extends AdminController
public function initContent()
{
$this->errors[] = Tools::displayError('Controller not found');
- $tpl_vars['controller'] = Tools::getvalue('controller');
-
+ $tpl_vars['controller'] = Tools::getvalue('controllerUri', Tools::getvalue('controller'));
$this->context->smarty->assign($tpl_vars);
parent::initContent();
}