diff --git a/src/App/controller/cart/CartController.php b/src/App/controller/cart/CartController.php
index b46f23500a271956fa6da5985d144d7445e604af..ab3c256b539ef5b8c1de7d37bc5b71b60aa2eb79 100644
--- a/src/App/controller/cart/CartController.php
+++ b/src/App/controller/cart/CartController.php
@@ -2,8 +2,11 @@
 
 class CartController extends Controller {
     public function index($page = 1) {
-        if($this->userRole !== 1) {
+        if($this->userRole === 2) {
             throw new Exception("You are not allowed to view this page", 405);
+        }else if($this->userRole === 0) {
+            header("Location: /login");
+            exit();
         }
 
         $isCheckout = false;
diff --git a/src/App/controller/category/CheckoutController.php b/src/App/controller/cart/CheckoutController.php
similarity index 100%
rename from src/App/controller/category/CheckoutController.php
rename to src/App/controller/cart/CheckoutController.php
diff --git a/src/App/controller/category/AddCategoryController.php b/src/App/controller/category/AddCategoryController.php
index 4ccc459a84e0346d5798b3176ad6625b70283a0a..6c85a8aaa337ec58d6289054eee2276860829b56 100644
--- a/src/App/controller/category/AddCategoryController.php
+++ b/src/App/controller/category/AddCategoryController.php
@@ -2,8 +2,11 @@
 
 class addCategoryController extends Controller{
     public function post(){
-        if($this->userRole !== 2) {
+        if($this->userRole === 1) {
             throw new Exception("You are not allowed to view this page", 405);
+        }else if($this->userRole === 0) {
+            header("Location: /login");
+            exit();
         }
 
         $category_name = $_POST["category_name"];
diff --git a/src/App/controller/category/CategoryController.php b/src/App/controller/category/CategoryController.php
index 16c9be4db44cdf800f2912e231d4fb963c73e4b3..7ce39dd54f6ebe74c77a5c56a73a6639f13893d3 100644
--- a/src/App/controller/category/CategoryController.php
+++ b/src/App/controller/category/CategoryController.php
@@ -2,8 +2,11 @@
 
 class CategoryController extends Controller{
     public function index($page = 1){
-        if($this->userRole !== 2) {
+        if($this->userRole === 1) {
             throw new Exception("You are not allowed to view this page", 405);
+        }else if($this->userRole === 0) {
+            header("Location: /login");
+            exit();
         }
         
         $categoryModel = $this->model("CategoryModel");
diff --git a/src/App/controller/login/LoginController.php b/src/App/controller/login/LoginController.php
index ffe780296341c25d28af42ab757f49b726500cf5..a97677a180d35b05b7d590e53aeba6fdce7019d5 100644
--- a/src/App/controller/login/LoginController.php
+++ b/src/App/controller/login/LoginController.php
@@ -3,7 +3,8 @@
 class LoginController extends Controller{
     public function index() {
         if($this->userRole !== 0) {
-            throw new Exception("You are not allowed to view this page", 405);
+            header("Location: /");
+            exit();
         }
         
         $dir = __DIR__;
diff --git a/src/App/controller/login/RegisterController.php b/src/App/controller/login/RegisterController.php
index 13c2422deb7017d6d30f9192e2a39fd39149e16c..864670e1c5eebb137e95a870083a291745c5ec29 100644
--- a/src/App/controller/login/RegisterController.php
+++ b/src/App/controller/login/RegisterController.php
@@ -3,7 +3,8 @@
 class RegisterController extends Controller{
     public function index() {
         if($this->userRole !== 0) {
-            throw new Exception("You are not allowed to view this page", 405);
+            header("Location: /");
+            exit();
         }
 
         $dir = __DIR__;
diff --git a/src/App/controller/product/AddProductController.php b/src/App/controller/product/AddProductController.php
index 1b50c0b3978fe4f43232ceb4823e99b0d83792b2..9fdbede3530c066ec4b86c088dd733b13cec245f 100644
--- a/src/App/controller/product/AddProductController.php
+++ b/src/App/controller/product/AddProductController.php
@@ -1,10 +1,12 @@
 <?php
 
 class AddProductController extends Controller{
-
     public function index(){
-        if($this->userRole !== 2) {
+        if($this->userRole === 1) {
             throw new Exception("You are not allowed to view this page", 405);
+        }else if($this->userRole === 0) {
+            header("Location: /login");
+            exit();
         }
         
         $categoryModel = $this->model("CategoryModel");
diff --git a/src/App/controller/product/EditProductController.php b/src/App/controller/product/EditProductController.php
index 1a022610ed9a5acde25fb629ad674b8535f717e2..1626fb32b101a543914e53975d798212eadcbc9a 100644
--- a/src/App/controller/product/EditProductController.php
+++ b/src/App/controller/product/EditProductController.php
@@ -3,8 +3,11 @@
 class EditProductController extends Controller{
 
     public function index($id){
-        if($this->userRole !== 2) {
+        if($this->userRole === 1) {
             throw new Exception("You are not allowed to view this page", 405);
+        }else if($this->userRole === 0) {
+            header("Location: /login");
+            exit();
         }
 
         $productModel = $this->model("ProductModel");
diff --git a/src/App/controller/product/ProductController.php b/src/App/controller/product/ProductController.php
index c575cb388e2619d69ce82e36adfe40623a118014..748453e0e98477062d0e917ba4cfec326a2d130e 100644
--- a/src/App/controller/product/ProductController.php
+++ b/src/App/controller/product/ProductController.php
@@ -4,7 +4,9 @@
 
 class ProductController extends Controller{
     public function index($id){
-        if($this->userRole !== 1) {
+        if($this->userRole === 2) {
+            throw new Exception("You are not allowed to view this page", 405);
+        }else if($this->userRole === 0) {
             header("Location: /login");
             exit();
         }