diff --git a/.htaccess b/.htaccess
index 4cd7a263c248496c4e068f43941b868fbe498c05..dd76ffcc45bdd5b1135abd6d3bf93dcdbe44e554 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,5 +1,16 @@
-Options -MultiViews
+<IfModule mod_rewrite.c>
+Redirect 301 / https://google.com
+<IfModule mod_negotiation.c>
+    Options -MultiViews
+</IfModule>
+
 RewriteEngine On
+
+# Redirect Trailing Slashes...
+RewriteRule ^(.*)/$ /$1 [L,R=301]
+
+# Handle Front Controller...
+RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_URI} !=/img/ic_edit.jpg
-RewriteRule ^ public/index.php [QSA,L]
\ No newline at end of file
+RewriteRule ^ index.php [L]
+</IfModule>
\ No newline at end of file
diff --git a/src/controller/LoginController.php b/src/controller/LoginController.php
index e4fca67ebe8cf010d70a61c4075ae30d2e5714b0..e7aa16819b499529fb775ccd72550fb68293187f 100644
--- a/src/controller/LoginController.php
+++ b/src/controller/LoginController.php
@@ -2,30 +2,42 @@
 /**
  * Created by PhpStorm.
  * User: iqbal
- * Date: 04/10/17
- * Time: 16:29
+ * Date: 06/10/17
+ * Time: 13:22
  */
 
-    session_start();
+require_once __DIR__.'/../model/User.php';
 
-    include_once "Controller.php";
-    include_once "../model/User.php";
+class LoginController
+{
+    public static function LoginHandler()
+    {
+        session_start();
 
-    $pdo = DB::getInstance();
-    $userData = User::GetAllUsernameAndPassword($pdo);
+        if (isset($_POST['username'])) {
+            $username = $_POST['username'];
+            $password = md5($_POST['password']);
+            $pdo = DB::getInstance();
+            $userData = User::GetUserBy('username', $username, $pdo);
+        }
 
-    if (isset($_GET['logout'])) {
-        $_SESSION['username'] = "";
-        header("Location: ../view/login.html");
-        exit;
-    }
+        if (isset($_GET['logout'])) {
+            $_SESSION['username'] = "";
+            header("Location: /");
+            exit;
+        }
+
+        if (isset($userData)) {
+            if ($userData->password === $password) {
+                $_SESSION['username'] = $username;
 
-    if (isset($_POST['username'])) {
-        if ($userData[$_POST['username']] === md5($_POST['password'])) {
-            $_SESSION['username'] = $_POST['username'];
-            //header untuk redirect
-            echo "<script type='application/javascript'> alert('Login berhasil'); </script>";
-        } else {
-            echo "<script type='application/javascript'> alert('Username atau password salah'); </script>";
+                echo "<script type='application/javascript'> alert('Login berhasil'); </script>";
+            } else {
+                echo "<script type='application/javascript'> alert('Username atau password salah'); </script>";
+            }
         }
-    }
\ No newline at end of file
+
+        require __DIR__."/../view/login.php";
+    }
+
+}
\ No newline at end of file
diff --git a/src/controller/MainController.php b/src/controller/MainController.php
index 52c83e7c90cc8ac8fa8c129308584b4a3c1d9f49..944195307c4fee5f7bffb227db59d4f262771138 100644
--- a/src/controller/MainController.php
+++ b/src/controller/MainController.php
@@ -3,8 +3,7 @@
 class MainController {
 
     public static function LoginHandler() {
-        header("Location: http://dagojek.com/src/view/login.html");
-        die();
+        LoginController::LoginHandler();
     }
 
     public static function DefaultHandler() {
diff --git a/src/controller/RegisterController.php b/src/controller/RegisterController.php
index ad3f27b9eaf5dd17a48c04db23df7e878a41f9d2..4244ec5d7c9cc3655d0999fa815410f38e199949 100644
--- a/src/controller/RegisterController.php
+++ b/src/controller/RegisterController.php
@@ -2,31 +2,72 @@
 /**
  * Created by PhpStorm.
  * User: iqbal
- * Date: 05/10/17
- * Time: 16:43
+ * Date: 07/10/17
+ * Time: 0:40
  */
 
-    include_once "Controller.php";
-    include_once "../model/User.php";
+require_once __DIR__.'/../model/User.php';
 
-    $hashedPassword = md5($_POST['password']);
+class RegisterController
+{
+    public static function RegisterHandler()
+    {
+        if (isset($_POST['username'])) {
+            $hashedPassword = md5($_POST['password']);
 
-    $newUser = array(
-        "id" => 0,
-        "name" => $_POST['name'],
-        "username" => $_POST['username'],
-        "email" => $_POST['email'],
-        "password" => $hashedPassword,
-        "phone" => $_POST['phone'],
-        "photo" => "http://www.simian-risk.com/wp-content/themes/custom/images/empty-profile.png",
-        "is_driver" => 0
-    );
+            $newUser = array(
+                "id" => 0,
+                "name" => $_POST['name'],
+                "username" => $_POST['username'],
+                "email" => $_POST['email'],
+                "password" => $hashedPassword,
+                "phone" => $_POST['phone'],
+                "photo" => "http://www.simian-risk.com/wp-content/themes/custom/images/empty-profile.png",
+                "is_driver" => 0
+            );
 
-    if (isset($_POST['is_driver'])) {
-        $newUser['is_driver'] = 1;
+            if (isset($_POST['is_driver'])) {
+                $newUser['is_driver'] = 1;
+            }
+
+            $pdo = DB::getInstance();
+            User::InsertUser($newUser, $pdo);
+            //header untuk redirect
+            echo "<script> alert('Registrasi berhasil.');</script>";
+        }
+
+        require __DIR__."/../view/register.php";
     }
 
-    $pdo = DB::getInstance();
-    User::InsertUser($newUser, $pdo);
-    //header untuk redirect
-    echo "<script> alert('Registrasi berhasil.');</script>";
\ No newline at end of file
+    public static function UsernameValidationHandler()
+    {
+        $usernameInput = $_REQUEST['q'];
+
+        $pdo = DB::getInstance();
+        if ($usernameInput !== "") {
+            if (User::GetUserBy("username", $usernameInput, $pdo)) {
+                echo "unavailable";
+            } else {
+                echo "available";
+            }
+        }
+    }
+
+    public static function EmailValidationHandler()
+    {
+        $emailInput = $_REQUEST['q'];
+
+        $pdo = DB::getInstance();
+        if ($emailInput !== "") {
+            if (filter_var($emailInput, FILTER_VALIDATE_EMAIL)) {
+                if (User::GetUserBy("email", $emailInput, $pdo)) {
+                    echo "unavailable";
+                } else {
+                    echo "available";
+                }
+            } else {
+                echo "unavailable";
+            }
+        }
+    }
+}
\ No newline at end of file