From 43d9d2eba76528dc1bcaccb6896b110faa920cff Mon Sep 17 00:00:00 2001
From: Dan Brown <ssddanbrown@googlemail.com>
Date: Sun, 14 Aug 2016 12:29:35 +0100
Subject: [PATCH] Updated all application urls to allow path prefix.

Allows BookStack to be installed at a non-root location on a domain.
Closes #40.
---
 .env.example                                  |   6 +-
 app/Book.php                                  |   6 +-
 app/Chapter.php                               |   6 +-
 app/Exceptions/Handler.php                    |   4 +-
 app/Http/Controllers/Auth/AuthController.php  |   8 +-
 app/Http/Controllers/PageController.php       |   4 +-
 app/Http/Middleware/Authenticate.php          |   2 +-
 app/Page.php                                  |   8 +-
 app/Providers/PaginationServiceProvider.php   |  30 +++
 app/Repos/ImageRepo.php                       |   6 +-
 app/Services/ImageService.php                 |   2 +-
 app/Services/SocialAuthService.php            |   7 +-
 app/User.php                                  |   9 +
 app/helpers.php                               |  25 +-
 bootstrap/autoload.php                        |   1 +
 composer.json                                 |   5 +-
 config/app.php                                |   3 +-
 config/setting-defaults.php                   |   5 +-
 readme.md                                     |   1 +
 resources/assets/js/controllers.js            |  28 ++-
 resources/assets/js/directives.js             |  33 +--
 resources/assets/js/global.js                 |   9 +
 resources/assets/js/pages/page-form.js        |   6 +-
 resources/assets/js/pages/page-show.js        |   5 +-
 resources/assets/sass/_fonts.scss             |  44 ++--
 .../views/auth/forms/login/standard.blade.php |   2 +-
 resources/views/auth/login.blade.php          |  10 +-
 resources/views/auth/password.blade.php       |   4 +-
 .../views/auth/register-confirm.blade.php     |   4 +-
 resources/views/auth/register.blade.php       |   8 +-
 resources/views/auth/reset.blade.php          |   2 +-
 .../views/auth/user-unconfirmed.blade.php     |   2 +-
 resources/views/base.blade.php                |   5 +-
 resources/views/books/create.blade.php        |   2 +-
 resources/views/books/edit.blade.php          |   2 +-
 resources/views/books/index.blade.php         |   4 +-
 resources/views/books/show.blade.php          |  20 +-
 resources/views/books/sort.blade.php          |   8 +-
 resources/views/chapters/create.blade.php     |   2 +-
 resources/views/chapters/delete.blade.php     |   4 +-
 resources/views/chapters/edit.blade.php       |   2 +-
 resources/views/chapters/list-item.blade.php  |   2 +-
 resources/views/chapters/move.blade.php       |   6 +-
 .../views/chapters/restrictions.blade.php     |   2 +-
 resources/views/chapters/show.blade.php       |  24 +-
 .../views/emails/email-confirmation.blade.php | 218 ++++++++++--------
 resources/views/emails/password.blade.php     |   2 +-
 resources/views/errors/404.blade.php          |   2 +-
 resources/views/errors/503.blade.php          |  51 +---
 .../views/form/restriction-form.blade.php     |   2 +-
 resources/views/home.blade.php                |   4 +-
 resources/views/pages/delete.blade.php        |   4 +-
 resources/views/pages/edit.blade.php          |   4 +-
 resources/views/pages/form-toolbox.blade.php  |   4 +-
 resources/views/pages/form.blade.php          |   2 +-
 resources/views/pages/move.blade.php          |   8 +-
 resources/views/pages/page-display.blade.php  |   4 +-
 resources/views/pages/restrictions.blade.php  |   6 +-
 resources/views/pages/revisions.blade.php     |   6 +-
 resources/views/pages/show.blade.php          |  33 +--
 .../views/pages/sidebar-tree-list.blade.php   |   6 +-
 .../views/partials/activity-item.blade.php    |   6 +-
 .../views/partials/custom-styles.blade.php    |  12 +-
 resources/views/partials/highlight.blade.php  |   2 +-
 resources/views/public.blade.php              |  30 ++-
 resources/views/search/all.blade.php          |  14 +-
 .../views/search/entity-search-list.blade.php |   2 +-
 resources/views/settings/index.blade.php      |  10 +-
 resources/views/settings/navbar.blade.php     |   6 +-
 .../views/settings/roles/create.blade.php     |   2 +-
 .../views/settings/roles/delete.blade.php     |   6 +-
 resources/views/settings/roles/edit.blade.php |   4 +-
 resources/views/settings/roles/form.blade.php |   6 +-
 .../views/settings/roles/index.blade.php      |   4 +-
 resources/views/users/create.blade.php        |   4 +-
 resources/views/users/delete.blade.php        |   6 +-
 resources/views/users/edit.blade.php          |  14 +-
 resources/views/users/forms/ldap.blade.php    |   2 +-
 .../views/users/forms/standard.blade.php      |   2 +-
 resources/views/users/index.blade.php         |  14 +-
 resources/views/users/profile.blade.php       |   2 +-
 81 files changed, 479 insertions(+), 403 deletions(-)
 create mode 100644 app/Providers/PaginationServiceProvider.php

diff --git a/.env.example b/.env.example
index 5661cda22..e44a46ef3 100644
--- a/.env.example
+++ b/.env.example
@@ -3,6 +3,10 @@ APP_ENV=production
 APP_DEBUG=false
 APP_KEY=SomeRandomString
 
+# The below url has to be set if using social auth options
+# or if you are not using BookStack at the root path of your domain.
+# APP_URL=http://bookstack.dev
+
 # Database details
 DB_HOST=localhost
 DB_DATABASE=database_database
@@ -42,8 +46,6 @@ GITHUB_APP_ID=false
 GITHUB_APP_SECRET=false
 GOOGLE_APP_ID=false
 GOOGLE_APP_SECRET=false
-# URL used for social login redirects, NO TRAILING SLASH
-APP_URL=http://bookstack.dev
 
 # External services such as Gravatar
 DISABLE_EXTERNAL_SERVICES=false
diff --git a/app/Book.php b/app/Book.php
index af6d59bfd..aa2dee9c0 100644
--- a/app/Book.php
+++ b/app/Book.php
@@ -7,10 +7,14 @@ class Book extends Entity
 
     /**
      * Get the url for this book.
+     * @param string|bool $path
      * @return string
      */
-    public function getUrl()
+    public function getUrl($path = false)
     {
+        if ($path !== false) {
+            return baseUrl('/books/' . $this->slug . '/' . trim($path, '/'));
+        }
         return baseUrl('/books/' . $this->slug);
     }
 
diff --git a/app/Chapter.php b/app/Chapter.php
index 250e323f5..8f0453172 100644
--- a/app/Chapter.php
+++ b/app/Chapter.php
@@ -25,11 +25,15 @@ class Chapter extends Entity
 
     /**
      * Get the url of this chapter.
+     * @param string|bool $path
      * @return string
      */
-    public function getUrl()
+    public function getUrl($path = false)
     {
         $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug;
+        if ($path !== false) {
+            return baseUrl('/books/' . $bookSlug. '/chapter/' . $this->slug . '/' . trim($path, '/'));
+        }
         return baseUrl('/books/' . $bookSlug. '/chapter/' . $this->slug);
     }
 
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 14d553ed0..40dd1ec10 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -48,8 +48,8 @@ class Handler extends ExceptionHandler
         // Handle notify exceptions which will redirect to the
         // specified location then show a notification message.
         if ($e instanceof NotifyException) {
-            \Session::flash('error', $e->message);
-            return response()->redirectTo($e->redirectLocation);
+            session()->flash('error', $e->message);
+            return redirect($e->redirectLocation);
         }
 
         // Handle pretty exceptions which will show a friendly application-fitting page
diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php
index beb191d62..2cbc047ce 100644
--- a/app/Http/Controllers/Auth/AuthController.php
+++ b/app/Http/Controllers/Auth/AuthController.php
@@ -1,9 +1,6 @@
-<?php
-
-namespace BookStack\Http\Controllers\Auth;
+<?php namespace BookStack\Http\Controllers\Auth;
 
 use BookStack\Exceptions\AuthException;
-use BookStack\Exceptions\PrettyException;
 use Illuminate\Contracts\Auth\Authenticatable;
 use Illuminate\Http\Request;
 use BookStack\Exceptions\SocialSignInException;
@@ -36,7 +33,6 @@ class AuthController extends Controller
     protected $redirectAfterLogout = '/login';
     protected $username = 'email';
 
-
     protected $socialAuthService;
     protected $emailConfirmationService;
     protected $userRepo;
@@ -53,6 +49,8 @@ class AuthController extends Controller
         $this->socialAuthService = $socialAuthService;
         $this->emailConfirmationService = $emailConfirmationService;
         $this->userRepo = $userRepo;
+        $this->redirectPath = baseUrl('/');
+        $this->redirectAfterLogout = baseUrl('/login');
         $this->username = config('auth.method') === 'standard' ? 'email' : 'username';
         parent::__construct();
     }
diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php
index f35834e62..1509ace95 100644
--- a/app/Http/Controllers/PageController.php
+++ b/app/Http/Controllers/PageController.php
@@ -412,7 +412,7 @@ class PageController extends Controller
      */
     public function showRecentlyCreated()
     {
-        $pages = $this->pageRepo->getRecentlyCreatedPaginated(20);
+        $pages = $this->pageRepo->getRecentlyCreatedPaginated(20)->setPath(baseUrl('/pages/recently-created'));
         return view('pages/detailed-listing', [
             'title' => 'Recently Created Pages',
             'pages' => $pages
@@ -425,7 +425,7 @@ class PageController extends Controller
      */
     public function showRecentlyUpdated()
     {
-        $pages = $this->pageRepo->getRecentlyUpdatedPaginated(20);
+        $pages = $this->pageRepo->getRecentlyUpdatedPaginated(20)->setPath(baseUrl('/pages/recently-updated'));
         return view('pages/detailed-listing', [
             'title' => 'Recently Updated Pages',
             'pages' => $pages
diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php
index 599f40c84..ee5144e6c 100644
--- a/app/Http/Middleware/Authenticate.php
+++ b/app/Http/Middleware/Authenticate.php
@@ -33,7 +33,7 @@ class Authenticate
     public function handle($request, Closure $next)
     {
         if ($this->auth->check() && setting('registration-confirmation') && !$this->auth->user()->email_confirmed) {
-            return redirect()->guest('/register/confirm/awaiting');
+            return redirect()->guest(baseUrl('/register/confirm/awaiting'));
         }
 
         if ($this->auth->guest() && !setting('app-public')) {
diff --git a/app/Page.php b/app/Page.php
index 5902f4f5a..1961a4f7f 100644
--- a/app/Page.php
+++ b/app/Page.php
@@ -56,13 +56,19 @@ class Page extends Entity
 
     /**
      * Get the url for this page.
+     * @param string|bool $path
      * @return string
      */
-    public function getUrl()
+    public function getUrl($path = false)
     {
         $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug;
         $midText = $this->draft ? '/draft/' : '/page/';
         $idComponent = $this->draft ? $this->id : $this->slug;
+
+        if ($path !== false) {
+            return baseUrl('/books/' . $bookSlug . $midText . $idComponent . '/' . trim($path, '/'));
+        }
+
         return baseUrl('/books/' . $bookSlug . $midText . $idComponent);
     }
 
diff --git a/app/Providers/PaginationServiceProvider.php b/app/Providers/PaginationServiceProvider.php
new file mode 100644
index 000000000..a0e97f70d
--- /dev/null
+++ b/app/Providers/PaginationServiceProvider.php
@@ -0,0 +1,30 @@
+<?php namespace BookStack\Providers;
+
+
+use Illuminate\Support\ServiceProvider;
+use Illuminate\Pagination\Paginator;
+
+class PaginationServiceProvider extends ServiceProvider
+{
+    /**
+     * Register the service provider.
+     *
+     * @return void
+     */
+    public function register()
+    {
+        Paginator::currentPathResolver(function () {
+            return baseUrl($this->app['request']->path());
+        });
+
+        Paginator::currentPageResolver(function ($pageName = 'page') {
+            $page = $this->app['request']->input($pageName);
+
+            if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
+                return $page;
+            }
+
+            return 1;
+        });
+    }
+}
\ No newline at end of file
diff --git a/app/Repos/ImageRepo.php b/app/Repos/ImageRepo.php
index 916ebd3e1..435b8bbd7 100644
--- a/app/Repos/ImageRepo.php
+++ b/app/Repos/ImageRepo.php
@@ -13,7 +13,7 @@ class ImageRepo
 
     protected $image;
     protected $imageService;
-    protected $restictionService;
+    protected $restrictionService;
     protected $page;
 
     /**
@@ -27,7 +27,7 @@ class ImageRepo
     {
         $this->image = $image;
         $this->imageService = $imageService;
-        $this->restictionService = $permissionService;
+        $this->restrictionService = $permissionService;
         $this->page = $page;
     }
 
@@ -52,7 +52,7 @@ class ImageRepo
      */
     private function returnPaginated($query, $page = 0, $pageSize = 24)
     {
-        $images = $this->restictionService->filterRelatedPages($query, 'images', 'uploaded_to');
+        $images = $this->restrictionService->filterRelatedPages($query, 'images', 'uploaded_to');
         $images = $images->orderBy('created_at', 'desc')->skip($pageSize * $page)->take($pageSize + 1)->get();
         $hasMore = count($images) > $pageSize;
 
diff --git a/app/Services/ImageService.php b/app/Services/ImageService.php
index dd965c90f..d9bd61e9f 100644
--- a/app/Services/ImageService.php
+++ b/app/Services/ImageService.php
@@ -265,7 +265,7 @@ class ImageService
             $this->storageUrl = $storageUrl;
         }
 
-        return ($this->storageUrl == false ? '' : rtrim($this->storageUrl, '/')) . $filePath;
+        return ($this->storageUrl == false ? rtrim(baseUrl(''), '/') : rtrim($this->storageUrl, '/')) . $filePath;
     }
 
 
diff --git a/app/Services/SocialAuthService.php b/app/Services/SocialAuthService.php
index ba3479349..4b99df789 100644
--- a/app/Services/SocialAuthService.php
+++ b/app/Services/SocialAuthService.php
@@ -113,20 +113,20 @@ class SocialAuthService
         if ($isLoggedIn && $socialAccount === null) {
             $this->fillSocialAccount($socialDriver, $socialUser);
             $currentUser->socialAccounts()->save($this->socialAccount);
-            \Session::flash('success', title_case($socialDriver) . ' account was successfully attached to your profile.');
+            session()->flash('success', title_case($socialDriver) . ' account was successfully attached to your profile.');
             return redirect($currentUser->getEditUrl());
         }
 
         // When a user is logged in and the social account exists and is already linked to the current user.
         if ($isLoggedIn && $socialAccount !== null && $socialAccount->user->id === $currentUser->id) {
-            \Session::flash('error', 'This ' . title_case($socialDriver) . ' account is already attached to your profile.');
+            session()->flash('error', 'This ' . title_case($socialDriver) . ' account is already attached to your profile.');
             return redirect($currentUser->getEditUrl());
         }
 
         // When a user is logged in, A social account exists but the users do not match.
         // Change the user that the social account is assigned to.
         if ($isLoggedIn && $socialAccount !== null && $socialAccount->user->id != $currentUser->id) {
-            \Session::flash('success', 'This ' . title_case($socialDriver) . ' account is already used by another user.');
+            session()->flash('success', 'This ' . title_case($socialDriver) . ' account is already used by another user.');
             return redirect($currentUser->getEditUrl());
         }
 
@@ -135,6 +135,7 @@ class SocialAuthService
         if (setting('registration-enabled')) {
             $message .= ' or, If you do not yet have an account, You can register an account using the ' . $socialDriver . ' option';
         }
+        
         throw new SocialSignInException($message . '.', '/login');
     }
 
diff --git a/app/User.php b/app/User.php
index 6ab7ad3bf..32449971d 100644
--- a/app/User.php
+++ b/app/User.php
@@ -160,6 +160,15 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
         return baseUrl('/settings/users/' . $this->id);
     }
 
+    /**
+     * Get the url that links to this user's profile.
+     * @return mixed
+     */
+    public function getProfileUrl()
+    {
+        return baseUrl('/user/' . $this->id);
+    }
+
     /**
      * Get a shortened version of the user's name.
      * @param int $chars
diff --git a/app/helpers.php b/app/helpers.php
index 0b9a6afc6..541f23fbe 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -69,10 +69,33 @@ function setting($key, $default = false)
  */
 function baseUrl($path)
 {
+    if (strpos($path, 'http') === 0) return $path;
     $path = trim($path, '/');
     return rtrim(config('app.url'), '/') . '/' . $path;
 }
 
+/**
+ * Get an instance of the redirector.
+ * Overrides the default laravel redirect helper.
+ * Ensures it redirects even when the app is in a subdirectory.
+ *
+ * @param  string|null  $to
+ * @param  int     $status
+ * @param  array   $headers
+ * @param  bool    $secure
+ * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
+ */
+function redirect($to = null, $status = 302, $headers = [], $secure = null)
+{
+    if (is_null($to)) {
+        return app('redirect');
+    }
+
+    $to = baseUrl($to);
+
+    return app('redirect')->to($to, $status, $headers, $secure);
+}
+
 /**
  * Generate a url with multiple parameters for sorting purposes.
  * Works out the logic to set the correct sorting direction
@@ -102,5 +125,5 @@ function sortUrl($path, $data, $overrideData = [])
 
     if (count($queryStringSections) === 0) return $path;
 
-    return $path . '?' . implode('&', $queryStringSections);
+    return baseUrl($path . '?' . implode('&', $queryStringSections));
 }
\ No newline at end of file
diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php
index 383013796..29f66ace4 100644
--- a/bootstrap/autoload.php
+++ b/bootstrap/autoload.php
@@ -14,6 +14,7 @@ define('LARAVEL_START', microtime(true));
 |
 */
 
+require __DIR__.'/../app/helpers.php';
 require __DIR__.'/../vendor/autoload.php';
 
 /*
diff --git a/composer.json b/composer.json
index 8f375a279..5c77a68c4 100644
--- a/composer.json
+++ b/composer.json
@@ -29,10 +29,7 @@
         ],
         "psr-4": {
             "BookStack\\": "app/"
-        },
-        "files": [
-            "app/helpers.php"
-        ]
+        }
     },
     "autoload-dev": {
         "classmap": [
diff --git a/config/app.php b/config/app.php
index 6819fa481..0d6f6f2b0 100644
--- a/config/app.php
+++ b/config/app.php
@@ -130,7 +130,6 @@ return [
         Illuminate\Foundation\Providers\FoundationServiceProvider::class,
         Illuminate\Hashing\HashServiceProvider::class,
         Illuminate\Mail\MailServiceProvider::class,
-        Illuminate\Pagination\PaginationServiceProvider::class,
         Illuminate\Pipeline\PipelineServiceProvider::class,
         Illuminate\Queue\QueueServiceProvider::class,
         Illuminate\Redis\RedisServiceProvider::class,
@@ -153,6 +152,8 @@ return [
         /*
          * Application Service Providers...
          */
+        BookStack\Providers\PaginationServiceProvider::class,
+
         BookStack\Providers\AuthServiceProvider::class,
         BookStack\Providers\AppServiceProvider::class,
         BookStack\Providers\EventServiceProvider::class,
diff --git a/config/setting-defaults.php b/config/setting-defaults.php
index 6a55a0dc3..24a49c364 100644
--- a/config/setting-defaults.php
+++ b/config/setting-defaults.php
@@ -5,8 +5,9 @@
  */
 return [
 
-    'app-editor' => 'wysiwyg',
-    'app-color'  => '#0288D1',
+    'app-name'        => 'BookStack',
+    'app-editor'      => 'wysiwyg',
+    'app-color'       => '#0288D1',
     'app-color-light' => 'rgba(21, 101, 192, 0.15)'
 
 ];
\ No newline at end of file
diff --git a/readme.md b/readme.md
index 29ac44f5e..3a745beb1 100644
--- a/readme.md
+++ b/readme.md
@@ -50,3 +50,4 @@ These are the great projects used to help build BookStack:
 * [ZeroClipboard](http://zeroclipboard.org/)
 * [TinyColorPicker](http://www.dematte.at/tinyColorPicker/index.html)
 * [Marked](https://github.com/chjj/marked)
+* [Moment.js](http://momentjs.com/)
diff --git a/resources/assets/js/controllers.js b/resources/assets/js/controllers.js
index 406fd7e77..9067f6ca4 100644
--- a/resources/assets/js/controllers.js
+++ b/resources/assets/js/controllers.js
@@ -1,6 +1,6 @@
 "use strict";
 
-var moment = require('moment');
+const moment = require('moment');
 
 module.exports = function (ngApp, events) {
 
@@ -35,7 +35,7 @@ module.exports = function (ngApp, events) {
              * @returns {string}
              */
             $scope.getUploadUrl = function () {
-                return '/images/' + $scope.imageType + '/upload';
+                return window.baseUrl('/images/' + $scope.imageType + '/upload');
             };
 
             /**
@@ -133,7 +133,7 @@ module.exports = function (ngApp, events) {
                 $scope.showing = false;
             };
 
-            var baseUrl = '/images/' + $scope.imageType + '/all/'
+            var baseUrl = window.baseUrl('/images/' + $scope.imageType + '/all/');
 
             /**
              * Fetch the list image data from the server.
@@ -178,7 +178,7 @@ module.exports = function (ngApp, events) {
                 $scope.images = [];
                 $scope.hasMore = false;
                 page = 0;
-                baseUrl = '/images/' + $scope.imageType + '/search/';
+                baseUrl = window.baseUrl('/images/' + $scope.imageType + '/search/');
                 fetchData();
             };
 
@@ -192,7 +192,7 @@ module.exports = function (ngApp, events) {
                 $scope.hasMore = false;
                 page = 0;
                 $scope.view = viewName;
-                baseUrl = '/images/' + $scope.imageType  + '/' + viewName + '/';
+                baseUrl = window.baseUrl('/images/' + $scope.imageType  + '/' + viewName + '/');
                 fetchData();
             }
 
@@ -202,7 +202,7 @@ module.exports = function (ngApp, events) {
              */
             $scope.saveImageDetails = function (event) {
                 event.preventDefault();
-                var url = '/images/update/' + $scope.selectedImage.id;
+                var url = window.baseUrl('/images/update/' + $scope.selectedImage.id);
                 $http.put(url, this.selectedImage).then((response) => {
                     events.emit('success', 'Image details updated');
                 }, (response) => {
@@ -228,7 +228,7 @@ module.exports = function (ngApp, events) {
             $scope.deleteImage = function (event) {
                 event.preventDefault();
                 var force = $scope.dependantPages !== false;
-                var url = '/images/' + $scope.selectedImage.id;
+                var url = window.baseUrl('/images/' + $scope.selectedImage.id);
                 if (force) url += '?force=true';
                 $http.delete(url).then((response) => {
                     $scope.images.splice($scope.images.indexOf($scope.selectedImage), 1);
@@ -267,7 +267,7 @@ module.exports = function (ngApp, events) {
             if (term.length == 0) return;
             $scope.searching = true;
             $scope.searchResults = '';
-            var searchUrl = '/search/book/' + $attrs.bookId;
+            var searchUrl = window.baseUrl('/search/book/' + $attrs.bookId);
             searchUrl += '?term=' + encodeURIComponent(term);
             $http.get(searchUrl).then((response) => {
                 $scope.searchResults = $sce.trustAsHtml(response.data);
@@ -368,7 +368,8 @@ module.exports = function (ngApp, events) {
 
             if (isMarkdown) data.markdown = $scope.editContent;
 
-            $http.put('/ajax/page/' + pageId + '/save-draft', data).then((responseData) => {
+            let url = window.baseUrl('/ajax/page/' + pageId + '/save-draft');
+            $http.put(url, data).then((responseData) => {
                 var updateTime = moment.utc(moment.unix(responseData.data.timestamp)).toDate();
                 $scope.draftText = responseData.data.message + moment(updateTime).format('HH:mm');
                 if (!$scope.isNewPageDraft) $scope.isUpdateDraft = true;
@@ -393,7 +394,8 @@ module.exports = function (ngApp, events) {
          * content from the system via an AJAX request.
          */
         $scope.discardDraft = function () {
-            $http.get('/ajax/page/' + pageId).then((responseData) => {
+            let url = window.baseUrl('/ajax/page/' + pageId);
+            $http.get(url).then((responseData) => {
                 if (autoSave) $interval.cancel(autoSave);
                 $scope.draftText = 'Editing Page';
                 $scope.isUpdateDraft = false;
@@ -437,7 +439,8 @@ module.exports = function (ngApp, events) {
              * Get all tags for the current book and add into scope.
              */
             function getTags() {
-                $http.get('/ajax/tags/get/page/' + pageId).then((responseData) => {
+                let url = window.baseUrl('/ajax/tags/get/page/' + pageId);
+                $http.get(url).then((responseData) => {
                     $scope.tags = responseData.data;
                     addEmptyTag();
                 });
@@ -486,7 +489,8 @@ module.exports = function (ngApp, events) {
             $scope.saveTags = function() {
                 setTagOrder();
                 let postData = {tags: $scope.tags};
-                $http.post('/ajax/tags/update/page/' + pageId, postData).then((responseData) => {
+                let url = window.baseUrl('/ajax/tags/update/page/' + pageId);
+                $http.post(url, postData).then((responseData) => {
                     $scope.tags = responseData.data.tags;
                     addEmptyTag();
                     events.emit('success', responseData.data.message);
diff --git a/resources/assets/js/directives.js b/resources/assets/js/directives.js
index 8554da9f8..897707af5 100644
--- a/resources/assets/js/directives.js
+++ b/resources/assets/js/directives.js
@@ -1,10 +1,10 @@
 "use strict";
-var DropZone = require('dropzone');
-var markdown = require('marked');
+const DropZone = require('dropzone');
+const markdown = require('marked');
 
-var toggleSwitchTemplate = require('./components/toggle-switch.html');
-var imagePickerTemplate = require('./components/image-picker.html');
-var dropZoneTemplate = require('./components/drop-zone.html');
+const toggleSwitchTemplate = require('./components/toggle-switch.html');
+const imagePickerTemplate = require('./components/image-picker.html');
+const dropZoneTemplate = require('./components/drop-zone.html');
 
 module.exports = function (ngApp, events) {
 
@@ -54,7 +54,7 @@ module.exports = function (ngApp, events) {
                 imageClass: '@'
             },
             link: function (scope, element, attrs) {
-                var usingIds = typeof scope.currentId !== 'undefined' || scope.currentId === 'false';
+                let usingIds = typeof scope.currentId !== 'undefined' || scope.currentId === 'false';
                 scope.image = scope.currentImage;
                 scope.value = scope.currentImage || '';
                 if (usingIds) scope.value = scope.currentId;
@@ -80,7 +80,7 @@ module.exports = function (ngApp, events) {
                 };
 
                 scope.updateImageFromModel = function (model) {
-                    var isResized = scope.resizeWidth && scope.resizeHeight;
+                    let isResized = scope.resizeWidth && scope.resizeHeight;
 
                     if (!isResized) {
                         scope.$apply(() => {
@@ -89,8 +89,9 @@ module.exports = function (ngApp, events) {
                         return;
                     }
 
-                    var cropped = scope.resizeCrop ? 'true' : 'false';
-                    var requestString = '/images/thumb/' + model.id + '/' + scope.resizeWidth + '/' + scope.resizeHeight + '/' + cropped;
+                    let cropped = scope.resizeCrop ? 'true' : 'false';
+                    let requestString = '/images/thumb/' + model.id + '/' + scope.resizeWidth + '/' + scope.resizeHeight + '/' + cropped;
+                    requestString = window.baseUrl(requestString);
                     $http.get(requestString).then((response) => {
                         setImage(model, response.data.url);
                     });
@@ -332,9 +333,9 @@ module.exports = function (ngApp, events) {
                     // Insert image shortcut
                     if (event.which === 73 && event.ctrlKey && event.shiftKey) {
                         event.preventDefault();
-                        var caretPos = input[0].selectionStart;
-                        var currentContent = input.val();
-                        var mdImageText = "![](http://)";
+                        let caretPos = input[0].selectionStart;
+                        let currentContent = input.val();
+                        const mdImageText = "![](http://)";
                         input.val(currentContent.substring(0, caretPos) + mdImageText + currentContent.substring(caretPos));
                         input.focus();
                         input[0].selectionStart = caretPos + ("![](".length);
@@ -348,9 +349,9 @@ module.exports = function (ngApp, events) {
                 // Insert image from image manager
                 insertImage.click(event => {
                     window.ImageManager.showExternal(image => {
-                        var caretPos = currentCaretPos;
-                        var currentContent = input.val();
-                        var mdImageText = "![" + image.name + "](" + image.url + ")";
+                        let caretPos = currentCaretPos;
+                        let currentContent = input.val();
+                        let mdImageText = "![" + image.name + "](" + image.url + ")";
                         input.val(currentContent.substring(0, caretPos) + mdImageText + currentContent.substring(caretPos));
                         input.change();
                     });
@@ -624,7 +625,7 @@ module.exports = function (ngApp, events) {
                 // Get search url with correct types
                 function getSearchUrl() {
                     let types = (attrs.entityTypes) ? encodeURIComponent(attrs.entityTypes) : encodeURIComponent('page,book,chapter');
-                    return `/ajax/search/entities?types=${types}`;
+                    return window.baseUrl(`/ajax/search/entities?types=${types}`);
                 }
 
                 // Get initial contents
diff --git a/resources/assets/js/global.js b/resources/assets/js/global.js
index 44562abd0..1c300ad26 100644
--- a/resources/assets/js/global.js
+++ b/resources/assets/js/global.js
@@ -7,6 +7,14 @@ var ngAnimate = require('angular-animate');
 var ngSanitize = require('angular-sanitize');
 require('angular-ui-sortable');
 
+// Url retrieval function
+window.baseUrl = function(path) {
+    let basePath = document.querySelector('meta[name="base-url"]').getAttribute('content');
+    if (basePath[basePath.length-1] === '/') basePath = basePath.slice(0, basePath.length-1);
+    if (path[0] === '/') path = path.slice(1);
+    return basePath + '/' + path;
+};
+
 var ngApp = angular.module('bookStack', ['ngResource', 'ngAnimate', 'ngSanitize', 'ui.sortable']);
 
 // Global Event System
@@ -29,6 +37,7 @@ var Events = {
 };
 window.Events = Events;
 
+
 var services = require('./services')(ngApp, Events);
 var directives = require('./directives')(ngApp, Events);
 var controllers = require('./controllers')(ngApp, Events);
diff --git a/resources/assets/js/pages/page-form.js b/resources/assets/js/pages/page-form.js
index 611d2e782..f8b314e9c 100644
--- a/resources/assets/js/pages/page-form.js
+++ b/resources/assets/js/pages/page-form.js
@@ -1,8 +1,8 @@
 var mceOptions = module.exports = {
     selector: '#html-editor',
     content_css: [
-        '/css/styles.css',
-        '/libs/material-design-iconic-font/css/material-design-iconic-font.min.css'
+        window.baseUrl('/css/styles.css'),
+        window.baseUrl('/libs/material-design-iconic-font/css/material-design-iconic-font.min.css')
     ],
     body_class: 'page-content',
     relative_urls: false,
@@ -148,7 +148,7 @@ var mceOptions = module.exports = {
                             formData.append('file', file, remoteFilename);
                             formData.append('_token', document.querySelector('meta[name="token"]').getAttribute('content'));
 
-                            xhr.open('POST', '/images/gallery/upload');
+                            xhr.open('POST', window.baseUrl('/images/gallery/upload'));
                             xhr.onload = function () {
                                 if (xhr.status === 200 || xhr.status === 201) {
                                     var result = JSON.parse(xhr.responseText);
diff --git a/resources/assets/js/pages/page-show.js b/resources/assets/js/pages/page-show.js
index b037612be..41b92453f 100644
--- a/resources/assets/js/pages/page-show.js
+++ b/resources/assets/js/pages/page-show.js
@@ -2,7 +2,7 @@
 // Configure ZeroClipboard
 var zeroClipBoard = require('zeroclipboard');
 zeroClipBoard.config({
-    swfPath: '/ZeroClipboard.swf'
+    swfPath: window.baseUrl('/ZeroClipboard.swf')
 });
 
 window.setupPageShow = module.exports = function (pageId) {
@@ -36,7 +36,8 @@ window.setupPageShow = module.exports = function (pageId) {
 
         // Show pointer and set link
         var $elem = $(this);
-        var link = window.location.protocol + "//" + window.location.host + '/link/' + pageId + '#' + $elem.attr('id');
+        let link = window.baseUrl('/link/' + pageId + '#' + $elem.attr('id'));
+        if (link.indexOf('http') !== 0) link = window.location.protocol + "//" + window.location.host + link;
         $pointer.find('input').val(link);
         $pointer.find('button').first().attr('data-clipboard-text', link);
         $elem.before($pointer);
diff --git a/resources/assets/sass/_fonts.scss b/resources/assets/sass/_fonts.scss
index c9dff31e1..c8e8ea833 100644
--- a/resources/assets/sass/_fonts.scss
+++ b/resources/assets/sass/_fonts.scss
@@ -6,8 +6,8 @@
   font-style: normal;
   font-weight: 100;
   src: local('Roboto Thin'), local('Roboto-Thin'),
-  url('/fonts/roboto-v15-cyrillic_latin-100.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-100.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-100.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-100.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-100italic - cyrillic_latin */
 @font-face {
@@ -15,8 +15,8 @@
   font-style: italic;
   font-weight: 100;
   src: local('Roboto Thin Italic'), local('Roboto-ThinItalic'),
-  url('/fonts/roboto-v15-cyrillic_latin-100italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-100italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-100italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-100italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-300 - cyrillic_latin */
 @font-face {
@@ -24,8 +24,8 @@
   font-style: normal;
   font-weight: 300;
   src: local('Roboto Light'), local('Roboto-Light'),
-  url('/fonts/roboto-v15-cyrillic_latin-300.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-300.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-300.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-300.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-300italic - cyrillic_latin */
 @font-face {
@@ -33,8 +33,8 @@
   font-style: italic;
   font-weight: 300;
   src: local('Roboto Light Italic'), local('Roboto-LightItalic'),
-  url('/fonts/roboto-v15-cyrillic_latin-300italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-300italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-300italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-300italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-regular - cyrillic_latin */
 @font-face {
@@ -42,8 +42,8 @@
   font-style: normal;
   font-weight: 400;
   src: local('Roboto'), local('Roboto-Regular'),
-  url('/fonts/roboto-v15-cyrillic_latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-italic - cyrillic_latin */
 @font-face {
@@ -51,8 +51,8 @@
   font-style: italic;
   font-weight: 400;
   src: local('Roboto Italic'), local('Roboto-Italic'),
-  url('/fonts/roboto-v15-cyrillic_latin-italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-500 - cyrillic_latin */
 @font-face {
@@ -60,8 +60,8 @@
   font-style: normal;
   font-weight: 500;
   src: local('Roboto Medium'), local('Roboto-Medium'),
-  url('/fonts/roboto-v15-cyrillic_latin-500.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-500.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-500.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-500.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-500italic - cyrillic_latin */
 @font-face {
@@ -69,8 +69,8 @@
   font-style: italic;
   font-weight: 500;
   src: local('Roboto Medium Italic'), local('Roboto-MediumItalic'),
-  url('/fonts/roboto-v15-cyrillic_latin-500italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-500italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-500italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-500italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-700 - cyrillic_latin */
 @font-face {
@@ -78,8 +78,8 @@
   font-style: normal;
   font-weight: 700;
   src: local('Roboto Bold'), local('Roboto-Bold'),
-  url('/fonts/roboto-v15-cyrillic_latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 /* roboto-700italic - cyrillic_latin */
 @font-face {
@@ -87,8 +87,8 @@
   font-style: italic;
   font-weight: 700;
   src: local('Roboto Bold Italic'), local('Roboto-BoldItalic'),
-  url('/fonts/roboto-v15-cyrillic_latin-700italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-v15-cyrillic_latin-700italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-v15-cyrillic_latin-700italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-v15-cyrillic_latin-700italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
 
 /* roboto-mono-regular - latin */
@@ -97,6 +97,6 @@
   font-style: normal;
   font-weight: 400;
   src: local('Roboto Mono'), local('RobotoMono-Regular'),
-  url('/fonts/roboto-mono-v4-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
-  url('/fonts/roboto-mono-v4-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+  url('../fonts/roboto-mono-v4-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+ */
+  url('../fonts/roboto-mono-v4-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
 }
\ No newline at end of file
diff --git a/resources/views/auth/forms/login/standard.blade.php b/resources/views/auth/forms/login/standard.blade.php
index d9be2935a..abefd21a1 100644
--- a/resources/views/auth/forms/login/standard.blade.php
+++ b/resources/views/auth/forms/login/standard.blade.php
@@ -6,5 +6,5 @@
 <div class="form-group">
     <label for="password">Password</label>
     @include('form/password', ['name' => 'password', 'tabindex' => 2])
-    <span class="block small"><a href="/password/email">Forgot Password?</a></span>
+    <span class="block small"><a href="{{ baseUrl('/password/email') }}">Forgot Password?</a></span>
 </div>
\ No newline at end of file
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
index d1239b52c..4fa97c1d5 100644
--- a/resources/views/auth/login.blade.php
+++ b/resources/views/auth/login.blade.php
@@ -1,8 +1,8 @@
 @extends('public')
 
 @section('header-buttons')
-    @if(Setting::get('registration-enabled'))
-        <a href="/register"><i class="zmdi zmdi-account-add"></i>Sign up</a>
+    @if(setting('registration-enabled', false))
+        <a href="{{ baseUrl("/register") }}"><i class="zmdi zmdi-account-add"></i>Sign up</a>
     @endif
 @stop
 
@@ -12,7 +12,7 @@
         <div class="center-box">
             <h1>Log In</h1>
 
-            <form action="/login" method="POST" id="login-form">
+            <form action="{{ baseUrl("/login") }}" method="POST" id="login-form">
                 {!! csrf_field() !!}
 
 
@@ -34,10 +34,10 @@
                 <hr class="margin-top">
                 <h3 class="text-muted">Social Login</h3>
                 @if(isset($socialDrivers['google']))
-                    <a href="/login/service/google" style="color: #DC4E41;"><i class="zmdi zmdi-google-plus-box zmdi-hc-4x"></i></a>
+                    <a href="{{ baseUrl("/login/service/google") }}" style="color: #DC4E41;"><i class="zmdi zmdi-google-plus-box zmdi-hc-4x"></i></a>
                 @endif
                 @if(isset($socialDrivers['github']))
-                    <a href="/login/service/github" style="color:#444;"><i class="zmdi zmdi-github zmdi-hc-4x"></i></a>
+                    <a href="{{ baseUrl("/login/service/github") }}" style="color:#444;"><i class="zmdi zmdi-github zmdi-hc-4x"></i></a>
                 @endif
             @endif
         </div>
diff --git a/resources/views/auth/password.blade.php b/resources/views/auth/password.blade.php
index d3ea08e1c..d8536efa7 100644
--- a/resources/views/auth/password.blade.php
+++ b/resources/views/auth/password.blade.php
@@ -1,7 +1,5 @@
 @extends('public')
 
-@section('body-class', 'image-cover login')
-
 @section('content')
 
 
@@ -11,7 +9,7 @@
 
             <p class="muted small">Enter your email below and you will be sent an email with a password reset link.</p>
 
-            <form action="/password/email" method="POST">
+            <form action="{{ baseUrl("/password/email") }}" method="POST">
                 {!! csrf_field() !!}
 
                 <div class="form-group">
diff --git a/resources/views/auth/register-confirm.blade.php b/resources/views/auth/register-confirm.blade.php
index 2f70b9ffd..97fd65ab5 100644
--- a/resources/views/auth/register-confirm.blade.php
+++ b/resources/views/auth/register-confirm.blade.php
@@ -2,7 +2,7 @@
 
 @section('header-buttons')
     @if(!$signedIn)
-        <a href="/login"><i class="zmdi zmdi-sign-in"></i>Sign in</a>
+        <a href="{{ baseUrl("/login") }}"><i class="zmdi zmdi-sign-in"></i>Sign in</a>
     @endif
 @stop
 
@@ -11,7 +11,7 @@
     <div class="text-center">
         <div class="center-box">
             <h2>Thanks for registering!</h2>
-            <p>Please check your email and click the confirmation button to access {{ \Setting::get('app-name') }}.</p>
+            <p>Please check your email and click the confirmation button to access {{ setting('app-name', 'BookStack') }}.</p>
         </div>
     </div>
 
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php
index f85440e7f..8ae5fcf50 100644
--- a/resources/views/auth/register.blade.php
+++ b/resources/views/auth/register.blade.php
@@ -1,7 +1,7 @@
 @extends('public')
 
 @section('header-buttons')
-    <a href="/login"><i class="zmdi zmdi-sign-in"></i>Sign in</a>
+    <a href="{{ baseUrl("/login") }}"><i class="zmdi zmdi-sign-in"></i>Sign in</a>
 @stop
 
 @section('content')
@@ -10,7 +10,7 @@
         <div class="center-box">
             <h1>Sign Up</h1>
 
-            <form action="/register" method="POST">
+            <form action="{{ baseUrl("/register") }}" method="POST">
                 {!! csrf_field() !!}
 
                 <div class="form-group">
@@ -38,10 +38,10 @@
                 <h3 class="text-muted">Social Registration</h3>
                 <p class="text-small">Register and sign in using another service.</p>
                 @if(isset($socialDrivers['google']))
-                    <a href="/register/service/google" style="color: #DC4E41;"><i class="zmdi zmdi-google-plus-box zmdi-hc-4x"></i></a>
+                    <a href="{{ baseUrl("/register/service/google") }}" style="color: #DC4E41;"><i class="zmdi zmdi-google-plus-box zmdi-hc-4x"></i></a>
                 @endif
                 @if(isset($socialDrivers['github']))
-                    <a href="/register/service/github" style="color:#444;"><i class="zmdi zmdi-github zmdi-hc-4x"></i></a>
+                    <a href="{{ baseUrl("/register/service/github") }}" style="color:#444;"><i class="zmdi zmdi-github zmdi-hc-4x"></i></a>
                 @endif
             @endif
         </div>
diff --git a/resources/views/auth/reset.blade.php b/resources/views/auth/reset.blade.php
index c440f64e7..9a9a65ff0 100644
--- a/resources/views/auth/reset.blade.php
+++ b/resources/views/auth/reset.blade.php
@@ -9,7 +9,7 @@
         <div class="center-box text-left">
             <h1>Reset Password</h1>
 
-            <form action="/password/reset" method="POST">
+            <form action="{{ baseUrl("/password/reset") }}" method="POST">
                 {!! csrf_field() !!}
                 <input type="hidden" name="token" value="{{ $token }}">
 
diff --git a/resources/views/auth/user-unconfirmed.blade.php b/resources/views/auth/user-unconfirmed.blade.php
index 1b0a20a69..08178e891 100644
--- a/resources/views/auth/user-unconfirmed.blade.php
+++ b/resources/views/auth/user-unconfirmed.blade.php
@@ -10,7 +10,7 @@
                 If you cannot find the email you can re-send the confirmation email by submitting the form below.
             </p>
             <hr>
-            <form action="/register/confirm/resend" method="POST">
+            <form action="{{ baseUrl("/register/confirm/resend") }}" method="POST">
                 {!! csrf_field() !!}
                 <div class="form-group">
                     <label for="email">Email Address</label>
diff --git a/resources/views/base.blade.php b/resources/views/base.blade.php
index e9ed436c5..be47abdca 100644
--- a/resources/views/base.blade.php
+++ b/resources/views/base.blade.php
@@ -1,11 +1,12 @@
 <!DOCTYPE html>
 <html class="@yield('body-class')">
 <head>
-    <title>{{ isset($pageTitle) ? $pageTitle . ' | ' : '' }}{{ setting('app-name', 'BookStack') }}</title>
+    <title>{{ isset($pageTitle) ? $pageTitle . ' | ' : '' }}{{ setting('app-name') }}</title>
 
     <!-- Meta -->
     <meta name="viewport" content="width=device-width">
     <meta name="token" content="{{ csrf_token() }}">
+    <meta name="base-url" content="{{ baseUrl('/') }}">
     <meta charset="utf-8">
 
     <!-- Styles and Fonts -->
@@ -38,7 +39,7 @@
                         @if(setting('app-logo', '') !== 'none')
                             <img class="logo-image" src="{{ setting('app-logo', '') === '' ? baseUrl('/logo.png') : baseUrl(setting('app-logo', '')) }}" alt="Logo">
                         @endif
-                        <span class="logo-text">{{ setting('app-name', 'BookStack') }}</span>
+                        <span class="logo-text">{{ setting('app-name') }}</span>
                     </a>
                 </div>
                 <div class="col-lg-4 col-sm-3 text-center">
diff --git a/resources/views/books/create.blade.php b/resources/views/books/create.blade.php
index dd2de574d..60f4f65bd 100644
--- a/resources/views/books/create.blade.php
+++ b/resources/views/books/create.blade.php
@@ -4,7 +4,7 @@
 
 <div class="container small" ng-non-bindable>
     <h1>Create New Book</h1>
-    <form action="/books" method="POST">
+    <form action="{{ baseUrl("/books") }}" method="POST">
         @include('books/form')
     </form>
 </div>
diff --git a/resources/views/books/edit.blade.php b/resources/views/books/edit.blade.php
index 5bd8917c7..e67e6f459 100644
--- a/resources/views/books/edit.blade.php
+++ b/resources/views/books/edit.blade.php
@@ -4,7 +4,7 @@
 
     <div class="container small" ng-non-bindable>
         <h1>Edit Book</h1>
-        <form action="/books/{{$book->slug}}" method="POST">
+        <form action="{{ $book->getUrl() }}" method="POST">
             <input type="hidden" name="_method" value="PUT">
             @include('books/form', ['model' => $book])
         </form>
diff --git a/resources/views/books/index.blade.php b/resources/views/books/index.blade.php
index 7b5c92b5a..91906e7b8 100644
--- a/resources/views/books/index.blade.php
+++ b/resources/views/books/index.blade.php
@@ -9,7 +9,7 @@
                 <div class="col-xs-11 faded">
                     <div class="action-buttons">
                         @if($currentUser->can('book-create-all'))
-                            <a href="/books/create" class="text-pos text-button"><i class="zmdi zmdi-plus"></i>Add new book</a>
+                            <a href="{{ baseUrl("/books/create") }}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i>Add new book</a>
                         @endif
                     </div>
                 </div>
@@ -31,7 +31,7 @@
                 @else
                     <p class="text-muted">No books have been created.</p>
                     @if(userCan('books-create-all'))
-                        <a href="/books/create" class="text-pos"><i class="zmdi zmdi-edit"></i>Create one now</a>
+                        <a href="{{ baseUrl("/books/create") }}" class="text-pos"><i class="zmdi zmdi-edit"></i>Create one now</a>
                     @endif
                 @endif
             </div>
diff --git a/resources/views/books/show.blade.php b/resources/views/books/show.blade.php
index 12c36ba41..129851d5e 100644
--- a/resources/views/books/show.blade.php
+++ b/resources/views/books/show.blade.php
@@ -8,10 +8,10 @@
                 <div class="col-md-12">
                     <div class="action-buttons faded">
                         @if(userCan('page-create', $book))
-                            <a href="{{$book->getUrl() . '/page/create'}}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i> New Page</a>
+                            <a href="{{ $book->getUrl('/page/create') }}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i> New Page</a>
                         @endif
                         @if(userCan('chapter-create', $book))
-                            <a href="{{$book->getUrl() . '/chapter/create'}}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i> New Chapter</a>
+                            <a href="{{ $book->getUrl('/chapter/create') }}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i> New Chapter</a>
                         @endif
                         @if(userCan('book-update', $book))
                             <a href="{{$book->getEditUrl()}}" class="text-primary text-button"><i class="zmdi zmdi-edit"></i>Edit</a>
@@ -21,13 +21,13 @@
                                 <a dropdown-toggle class="text-primary text-button"><i class="zmdi zmdi-more-vert"></i></a>
                                 <ul>
                                     @if(userCan('book-update', $book))
-                                        <li><a href="{{ $book->getUrl() }}/sort" class="text-primary"><i class="zmdi zmdi-sort"></i>Sort</a></li>
+                                        <li><a href="{{ $book->getUrl('/sort') }}" class="text-primary"><i class="zmdi zmdi-sort"></i>Sort</a></li>
                                     @endif
                                     @if(userCan('restrictions-manage', $book))
-                                        <li><a href="{{$book->getUrl()}}/permissions" class="text-primary"><i class="zmdi zmdi-lock-outline"></i>Permissions</a></li>
+                                        <li><a href="{{ $book->getUrl('/permissions') }}" class="text-primary"><i class="zmdi zmdi-lock-outline"></i>Permissions</a></li>
                                     @endif
                                     @if(userCan('book-delete', $book))
-                                        <li><a href="{{ $book->getUrl() }}/delete" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a></li>
+                                        <li><a href="{{ $book->getUrl('/delete') }}" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a></li>
                                     @endif
                                 </ul>
                             </div>
@@ -61,16 +61,16 @@
                         @else
                             <p class="text-muted">No pages or chapters have been created for this book.</p>
                             <p>
-                                <a href="{{$book->getUrl() . '/page/create'}}" class="text-page"><i class="zmdi zmdi-file-text"></i>Create a new page</a>
+                                <a href="{{ $book->getUrl('/page/create') }}" class="text-page"><i class="zmdi zmdi-file-text"></i>Create a new page</a>
                                 &nbsp;&nbsp;<em class="text-muted">-or-</em>&nbsp;&nbsp;&nbsp;
-                                <a href="{{$book->getUrl() . '/chapter/create'}}" class="text-chapter"><i class="zmdi zmdi-collection-bookmark"></i>Add a chapter</a>
+                                <a href="{{ $book->getUrl('/chapter/create') }}" class="text-chapter"><i class="zmdi zmdi-collection-bookmark"></i>Add a chapter</a>
                             </p>
                             <hr>
                         @endif
                         <p class="text-muted small">
-                            Created {{$book->created_at->diffForHumans()}} @if($book->createdBy) by <a href="/user/{{ $book->createdBy->id }}">{{$book->createdBy->name}}</a> @endif
+                            Created {{$book->created_at->diffForHumans()}} @if($book->createdBy) by <a href="{{ $book->createdBy->getProfileUrl() }}">{{$book->createdBy->name}}</a> @endif
                             <br>
-                            Last Updated {{$book->updated_at->diffForHumans()}} @if($book->updatedBy) by <a href="/user/{{ $book->updatedBy->id }}">{{$book->updatedBy->name}}</a> @endif
+                            Last Updated {{$book->updated_at->diffForHumans()}} @if($book->updatedBy) by <a href="{{ $book->updatedBy->getProfileUrl() }}">{{$book->updatedBy->name}}</a> @endif
                         </p>
                     </div>
                 </div>
@@ -90,7 +90,7 @@
                 @if($book->restricted)
                     <p class="text-muted">
                         @if(userCan('restrictions-manage', $book))
-                            <a href="{{ $book->getUrl() }}/permissions"><i class="zmdi zmdi-lock-outline"></i>Book Permissions Active</a>
+                            <a href="{{ $book->getUrl('/permissions') }}"><i class="zmdi zmdi-lock-outline"></i>Book Permissions Active</a>
                         @else
                             <i class="zmdi zmdi-lock-outline"></i>Book Permissions Active
                         @endif
diff --git a/resources/views/books/sort.blade.php b/resources/views/books/sort.blade.php
index af4f1825b..3849dfcfc 100644
--- a/resources/views/books/sort.blade.php
+++ b/resources/views/books/sort.blade.php
@@ -1,7 +1,7 @@
 @extends('base')
 
 @section('head')
-    <script src="/libs/jquery-sortable/jquery-sortable.min.js"></script>
+    <script src="{{ baseUrl("/libs/jquery-sortable/jquery-sortable.min.js") }}"></script>
 @stop
 
 @section('content')
@@ -22,7 +22,7 @@
                     @foreach($books as $otherBook)
                         @if($otherBook->id !== $book->id)
                         <div>
-                            <a href="/books/{{ $otherBook->slug }}/sort-item" class="text-book"><i class="zmdi zmdi-book"></i>{{ $otherBook->name }}</a>
+                            <a href="{{ $otherBook->getUrl('/sort-item') }}" class="text-book"><i class="zmdi zmdi-book"></i>{{ $otherBook->name }}</a>
                         </div>
                         @endif
                     @endforeach
@@ -32,12 +32,12 @@
 
         </div>
 
-        <form action="{{$book->getUrl()}}/sort" method="POST">
+        <form action="{{ $book->getUrl('/sort') }}" method="POST">
             {!! csrf_field() !!}
             <input type="hidden" name="_method" value="PUT">
             <input type="hidden" id="sort-tree-input" name="sort-tree">
             <div class="list">
-                <a href="{{$book->getUrl()}}" class="button muted">Cancel</a>
+                <a href="{{ $book->getUrl() }}" class="button muted">Cancel</a>
                 <button class="button pos" type="submit">Save Order</button>
             </div>
         </form>
diff --git a/resources/views/chapters/create.blade.php b/resources/views/chapters/create.blade.php
index 7195e76fc..b81cb15d7 100644
--- a/resources/views/chapters/create.blade.php
+++ b/resources/views/chapters/create.blade.php
@@ -4,7 +4,7 @@
 
     <div class="container small" ng-non-bindable>
         <h1>Create New Chapter</h1>
-        <form action="{{$book->getUrl()}}/chapter/create" method="POST">
+        <form action="{{ $book->getUrl('/chapter/create') }}" method="POST">
             @include('chapters/form')
         </form>
     </div>
diff --git a/resources/views/chapters/delete.blade.php b/resources/views/chapters/delete.blade.php
index ac7c7ccde..e9573f228 100644
--- a/resources/views/chapters/delete.blade.php
+++ b/resources/views/chapters/delete.blade.php
@@ -8,10 +8,10 @@
         and added directly to the book.</p>
         <p class="text-neg">Are you sure you want to delete this chapter?</p>
 
-        <form action="{{$chapter->getUrl()}}" method="POST">
+        <form action="{{ $chapter->getUrl() }}" method="POST">
             {!! csrf_field() !!}
             <input type="hidden" name="_method" value="DELETE">
-            <a href="{{$chapter->getUrl()}}" class="button primary">Cancel</a>
+            <a href="{{ $chapter->getUrl() }}" class="button primary">Cancel</a>
             <button type="submit" class="button neg">Confirm</button>
         </form>
     </div>
diff --git a/resources/views/chapters/edit.blade.php b/resources/views/chapters/edit.blade.php
index aa76d5ca7..0363da96d 100644
--- a/resources/views/chapters/edit.blade.php
+++ b/resources/views/chapters/edit.blade.php
@@ -4,7 +4,7 @@
 
     <div class="container small" ng-non-bindable>
         <h1>Edit Chapter</h1>
-        <form action="{{$chapter->getUrl()}}" method="POST">
+        <form action="{{  $chapter->getUrl() }}" method="POST">
             <input type="hidden" name="_method" value="PUT">
             @include('chapters/form', ['model' => $chapter])
         </form>
diff --git a/resources/views/chapters/list-item.blade.php b/resources/views/chapters/list-item.blade.php
index 1567557d2..3677851df 100644
--- a/resources/views/chapters/list-item.blade.php
+++ b/resources/views/chapters/list-item.blade.php
@@ -20,7 +20,7 @@
         <p class="text-muted chapter-toggle"><i class="zmdi zmdi-caret-right"></i> <i class="zmdi zmdi-file-text"></i> <span>{{ count($chapter->pages) }} Pages</span></p>
         <div class="inset-list">
             @foreach($chapter->pages as $page)
-                <h4 class="@if($page->draft) draft @endif"><a href="{{$page->getUrl()}}" class="text-page @if($page->draft) draft @endif"><i class="zmdi zmdi-file-text"></i>{{$page->name}}</a></h4>
+                <h4 class="@if($page->draft) draft @endif"><a href="{{ $page->getUrl() }}" class="text-page @if($page->draft) draft @endif"><i class="zmdi zmdi-file-text"></i>{{$page->name}}</a></h4>
             @endforeach
         </div>
     @endif
diff --git a/resources/views/chapters/move.blade.php b/resources/views/chapters/move.blade.php
index c14dd6923..37d56d30d 100644
--- a/resources/views/chapters/move.blade.php
+++ b/resources/views/chapters/move.blade.php
@@ -7,9 +7,9 @@
             <div class="row">
                 <div class="col-sm-12 faded">
                     <div class="breadcrumbs">
-                        <a href="{{$book->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
+                        <a href="{{ $book->getUrl() }}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
                         <span class="sep">&raquo;</span>
-                        <a href="{{$chapter->getUrl()}}" class="text-chapter text-button"><i class="zmdi zmdi-collection-bookmark"></i>{{ $chapter->getShortName() }}</a>
+                        <a href="{{ $chapter->getUrl() }}" class="text-chapter text-button"><i class="zmdi zmdi-collection-bookmark"></i>{{ $chapter->getShortName() }}</a>
                     </div>
                 </div>
             </div>
@@ -19,7 +19,7 @@
     <div class="container">
         <h1>Move Chapter <small class="subheader">{{$chapter->name}}</small></h1>
 
-        <form action="{{ $chapter->getUrl() }}/move" method="POST">
+        <form action="{{ $chapter->getUrl('/move') }}" method="POST">
             {!! csrf_field() !!}
             <input type="hidden" name="_method" value="PUT">
 
diff --git a/resources/views/chapters/restrictions.blade.php b/resources/views/chapters/restrictions.blade.php
index c25c0755d..771665037 100644
--- a/resources/views/chapters/restrictions.blade.php
+++ b/resources/views/chapters/restrictions.blade.php
@@ -7,7 +7,7 @@
             <div class="row">
                 <div class="col-sm-12 faded">
                     <div class="breadcrumbs">
-                        <a href="{{$chapter->book->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $chapter->book->getShortName() }}</a>
+                        <a href="{{ $chapter->book->getUrl() }}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $chapter->book->getShortName() }}</a>
                         <span class="sep">&raquo;</span>
                         <a href="{{ $chapter->getUrl() }}" class="text-chapter text-button"><i class="zmdi zmdi-collection-bookmark"></i>{{$chapter->getShortName()}}</a>
                     </div>
diff --git a/resources/views/chapters/show.blade.php b/resources/views/chapters/show.blade.php
index b79cd8415..70b09e9ce 100644
--- a/resources/views/chapters/show.blade.php
+++ b/resources/views/chapters/show.blade.php
@@ -7,29 +7,29 @@
             <div class="row">
                 <div class="col-sm-8 faded" ng-non-bindable>
                     <div class="breadcrumbs">
-                        <a href="{{$book->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
+                        <a href="{{ $book->getUrl() }}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
                     </div>
                 </div>
                 <div class="col-sm-4 faded">
                     <div class="action-buttons">
                         @if(userCan('page-create', $chapter))
-                            <a href="{{$chapter->getUrl() . '/create-page'}}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i>New Page</a>
+                            <a href="{{ $chapter->getUrl('/create-page') }}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i>New Page</a>
                         @endif
                         @if(userCan('chapter-update', $chapter))
-                            <a href="{{$chapter->getUrl() . '/edit'}}" class="text-primary text-button"><i class="zmdi zmdi-edit"></i>Edit</a>
+                            <a href="{{ $chapter->getUrl('/edit') }}" class="text-primary text-button"><i class="zmdi zmdi-edit"></i>Edit</a>
                         @endif
                         @if(userCan('chapter-update', $chapter) || userCan('restrictions-manage', $chapter) || userCan('chapter-delete', $chapter))
                             <div dropdown class="dropdown-container">
                                 <a dropdown-toggle class="text-primary text-button"><i class="zmdi zmdi-more-vert"></i></a>
                                 <ul>
                                     @if(userCan('chapter-update', $chapter))
-                                        <li><a href="{{$chapter->getUrl() . '/move'}}" class="text-primary"><i class="zmdi zmdi-folder"></i>Move</a></li>
+                                        <li><a href="{{ $chapter->getUrl('/move') }}" class="text-primary"><i class="zmdi zmdi-folder"></i>Move</a></li>
                                     @endif
                                     @if(userCan('restrictions-manage', $chapter))
-                                        <li><a href="{{$chapter->getUrl()}}/permissions" class="text-primary"><i class="zmdi zmdi-lock-outline"></i>Permissions</a></li>
+                                        <li><a href="{{ $chapter->getUrl('/permissions') }}" class="text-primary"><i class="zmdi zmdi-lock-outline"></i>Permissions</a></li>
                                     @endif
                                     @if(userCan('chapter-delete', $chapter))
-                                        <li><a href="{{$chapter->getUrl() . '/delete'}}" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a></li>
+                                        <li><a href="{{ $chapter->getUrl('/delete') }}" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a></li>
                                     @endif
                                 </ul>
                             </div>
@@ -60,22 +60,22 @@
                     <p class="text-muted">No pages are currently in this chapter.</p>
                     <p>
                         @if(userCan('page-create', $chapter))
-                            <a href="{{$chapter->getUrl() . '/create-page'}}" class="text-page"><i class="zmdi zmdi-file-text"></i>Create a new page</a>
+                            <a href="{{ $chapter->getUrl('/create-page') }}" class="text-page"><i class="zmdi zmdi-file-text"></i>Create a new page</a>
                         @endif
                         @if(userCan('page-create', $chapter) && userCan('book-update', $book))
                             &nbsp;&nbsp;<em class="text-muted">-or-</em>&nbsp;&nbsp;&nbsp;
                         @endif
                         @if(userCan('book-update', $book))
-                            <a href="{{$book->getUrl() . '/sort'}}" class="text-book"><i class="zmdi zmdi-book"></i>Sort the current book</a>
+                            <a href="{{ $book->getUrl('/sort') }}" class="text-book"><i class="zmdi zmdi-book"></i>Sort the current book</a>
                         @endif
                     </p>
                     <hr>
                 @endif
 
                 <p class="text-muted small">
-                    Created {{$chapter->created_at->diffForHumans()}} @if($chapter->createdBy) by <a href="/user/{{ $chapter->createdBy->id }}">{{ $chapter->createdBy->name}}</a> @endif
+                    Created {{ $chapter->created_at->diffForHumans() }} @if($chapter->createdBy) by <a href="{{ $chapter->createdBy->getProfileUrl() }}">{{ $chapter->createdBy->name}}</a> @endif
                     <br>
-                    Last Updated {{$chapter->updated_at->diffForHumans()}} @if($chapter->updatedBy) by <a href="/user/{{ $chapter->updatedBy->id }}">{{  $chapter->updatedBy->name}}</a> @endif
+                    Last Updated {{ $chapter->updated_at->diffForHumans() }} @if($chapter->updatedBy) by <a href="{{ $chapter->updatedBy->getProfileUrl() }}">{{  $chapter->updatedBy->name}}</a> @endif
                 </p>
             </div>
             <div class="col-md-3 col-md-offset-1">
@@ -85,7 +85,7 @@
 
                         @if($book->restricted)
                             @if(userCan('restrictions-manage', $book))
-                                <a href="{{ $book->getUrl() }}/permissions"><i class="zmdi zmdi-lock-outline"></i>Book Permissions Active</a>
+                                <a href="{{ $book->getUrl('/permissions') }}"><i class="zmdi zmdi-lock-outline"></i>Book Permissions Active</a>
                             @else
                                 <i class="zmdi zmdi-lock-outline"></i>Book Permissions Active
                             @endif
@@ -94,7 +94,7 @@
 
                         @if($chapter->restricted)
                             @if(userCan('restrictions-manage', $chapter))
-                                <a href="{{ $chapter->getUrl() }}/permissions"><i class="zmdi zmdi-lock-outline"></i>Chapter Permissions Active</a>
+                                <a href="{{ $chapter->getUrl('/permissions') }}"><i class="zmdi zmdi-lock-outline"></i>Chapter Permissions Active</a>
                             @else
                                 <i class="zmdi zmdi-lock-outline"></i>Chapter Permissions Active
                             @endif
diff --git a/resources/views/emails/email-confirmation.blade.php b/resources/views/emails/email-confirmation.blade.php
index 618710041..6a0dc0378 100644
--- a/resources/views/emails/email-confirmation.blade.php
+++ b/resources/views/emails/email-confirmation.blade.php
@@ -1,176 +1,190 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
 
 <head style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
-    <meta name="viewport" content="width=device-width" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" />
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" />
-    <title>Confirm Your Email At {{ Setting::get('app-name')}}</title>
+    <meta name="viewport" content="width=device-width"
+          style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"/>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
+          style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"/>
+    <title>Confirm Your Email At {{ setting('app-name')}}</title>
     <style style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
         * {
-        margin: 0;
-        padding: 0;
-        font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
-        font-size: 100%;
-        line-height: 1.6;
+            margin: 0;
+            padding: 0;
+            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
+            font-size: 100%;
+            line-height: 1.6;
         }
 
         img {
-        max-width: 100%;
+            max-width: 100%;
         }
 
         body {
-        -webkit-font-smoothing: antialiased;
-        -webkit-text-size-adjust: none;
-        width: 100%!important;
-        height: 100%;
+            -webkit-font-smoothing: antialiased;
+            -webkit-text-size-adjust: none;
+            width: 100% !important;
+            height: 100%;
         }
 
         a {
-        color: #348eda;
+            color: #348eda;
         }
 
         .btn-primary {
-        text-decoration: none;
-        color: #FFF;
-        background-color: #348eda;
-        border: solid #348eda;
-        border-width: 10px 20px;
-        line-height: 2;
-        font-weight: bold;
-        margin-right: 10px;
-        text-align: center;
-        cursor: pointer;
-        display: inline-block;
-        border-radius: 4px;
+            text-decoration: none;
+            color: #FFF;
+            background-color: #348eda;
+            border: solid #348eda;
+            border-width: 10px 20px;
+            line-height: 2;
+            font-weight: bold;
+            margin-right: 10px;
+            text-align: center;
+            cursor: pointer;
+            display: inline-block;
+            border-radius: 4px;
         }
 
         .btn-secondary {
-        text-decoration: none;
-        color: #FFF;
-        background-color: #aaa;
-        border: solid #aaa;
-        border-width: 10px 20px;
-        line-height: 2;
-        font-weight: bold;
-        margin-right: 10px;
-        text-align: center;
-        cursor: pointer;
-        display: inline-block;
-        border-radius: 25px;
+            text-decoration: none;
+            color: #FFF;
+            background-color: #aaa;
+            border: solid #aaa;
+            border-width: 10px 20px;
+            line-height: 2;
+            font-weight: bold;
+            margin-right: 10px;
+            text-align: center;
+            cursor: pointer;
+            display: inline-block;
+            border-radius: 25px;
         }
 
         .last {
-        margin-bottom: 0;
+            margin-bottom: 0;
         }
 
         .first {
-        margin-top: 0;
+            margin-top: 0;
         }
 
         .padding {
-        padding: 10px 0;
+            padding: 10px 0;
         }
 
         table.body-wrap {
-        width: 100%;
-        padding: 20px;
+            width: 100%;
+            padding: 20px;
         }
 
         table.body-wrap .container {
-        border: 1px solid #f0f0f0;
+            border: 1px solid #f0f0f0;
         }
 
         h1,
         h2,
         h3 {
-        font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
-        color: #444;
-        margin: 10px 0 10px;
-        line-height: 1.2;
-        font-weight: 200;
+            font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
+            color: #444;
+            margin: 10px 0 10px;
+            line-height: 1.2;
+            font-weight: 200;
         }
 
         h1 {
-        font-size: 36px;
+            font-size: 36px;
         }
 
         h2 {
-        font-size: 28px;
+            font-size: 28px;
         }
 
         h3 {
-        font-size: 22px;
+            font-size: 22px;
         }
 
         p,
         ul,
         ol {
-        margin-bottom: 10px;
-        font-weight: normal;
-        font-size: 14px;
-        color: #888888;
+            margin-bottom: 10px;
+            font-weight: normal;
+            font-size: 14px;
+            color: #888888;
         }
 
         ul li,
         ol li {
-        margin-left: 5px;
-        list-style-position: inside;
+            margin-left: 5px;
+            list-style-position: inside;
         }
 
         .container {
-        display: block!important;
-        max-width: 600px!important;
-        margin: 0 auto!important;
-        clear: both!important;
+            display: block !important;
+            max-width: 600px !important;
+            margin: 0 auto !important;
+            clear: both !important;
         }
 
         .body-wrap .container {
-        padding: 20px;
+            padding: 20px;
         }
 
         .content {
-        max-width: 600px;
-        margin: 0 auto;
-        display: block;
+            max-width: 600px;
+            margin: 0 auto;
+            display: block;
         }
 
         .content table {
-        width: 100%;
+            width: 100%;
         }
     </style>
-    </head>
+</head>
 
-    <body bgcolor="#f6f6f6" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%;">
-    <!-- body -->
-    <table class="body-wrap" bgcolor="#f6f6f6" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;">
+<body bgcolor="#f6f6f6"
+      style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%;">
+<!-- body -->
+<table class="body-wrap" bgcolor="#f6f6f6"
+       style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;">
     <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
-    <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>
-                                                                                                                                                                                                                                                  <td class="container" bgcolor="#FFFFFF" style="font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;display:block!important;max-width:600px!important;margin-top:0 !important;margin-bottom:0 !important;margin-right:auto !important;margin-left:auto !important;clear:both!important;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;border-width:1px;border-style:solid;border-color:#f0f0f0;">
-    <!-- content -->
-    <div class="content" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;display:block;">
-    <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
-    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
-    <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
-    <h1 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;color:#444;margin-top:10px;margin-bottom:10px;margin-right:0;margin-left:0;line-height:1.2;font-weight:200;font-size:36px;">Email Confirmation</h1>
-                                                                                                                                                                                                                                                                                                         <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">Thanks for joining <a href="{{ url('/') }}">{{ Setting::get('app-name')}}</a>. <br />
-    Please confirm your email address by clicking the button below.</p>
-                                                                     <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
-    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
-    <td class="padding" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;">
-    <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;"><a class="btn-primary" href="{{ url('/register/confirm/'.$token) }}" style="margin-top:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;text-decoration:none;color:#FFF;background-color:#348eda;border-style:solid;border-color:#348eda;border-width:10px 20px;line-height:2;font-weight:bold;margin-right:10px;text-align:center;cursor:pointer;display:inline-block;border-radius:4px;">Confirm Email</a></p>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </td>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  </tr>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    </table>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      </td>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </tr>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          </table>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </div>
-    <!-- /content -->
-    </td>
-      <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>
-                                                                                                                                                                                                                                                    </tr>
-                                                                                                                                                                                                                                                      </table>
-    <!-- /body -->
-    </body>
+        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>
+        <td class="container" bgcolor="#FFFFFF"
+            style="font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;display:block!important;max-width:600px!important;margin-top:0 !important;margin-bottom:0 !important;margin-right:auto !important;margin-left:auto !important;clear:both!important;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;border-width:1px;border-style:solid;border-color:#f0f0f0;">
+            <!-- content -->
+            <div class="content"
+                 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;display:block;">
+                <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
+                    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
+                        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
+                            <h1 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;color:#444;margin-top:10px;margin-bottom:10px;margin-right:0;margin-left:0;line-height:1.2;font-weight:200;font-size:36px;">
+                                Email Confirmation</h1>
+                            <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">
+                                Thanks for joining <a href="{{ baseUrl('/') }}">{{ setting('app-name')}}</a>. <br/>
+                                Please confirm your email address by clicking the button below.</p>
+                            <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
+                                <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
+                                    <td class="padding"
+                                        style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;">
+                                        <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">
+                                            <a class="btn-primary" href="{{ baseUrl('/register/confirm/' . $token) }}"
+                                               style="margin-top:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;text-decoration:none;color:#FFF;background-color:#348eda;border-style:solid;border-color:#348eda;border-width:10px 20px;line-height:2;font-weight:bold;margin-right:10px;text-align:center;cursor:pointer;display:inline-block;border-radius:4px;">Confirm
+                                                Email</a></p>
+                                    </td>
+                                </tr>
+                            </table>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+            <!-- /content -->
+        </td>
+        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>
+    </tr>
+</table>
+<!-- /body -->
+</body>
 
-      </html>
+</html>
diff --git a/resources/views/emails/password.blade.php b/resources/views/emails/password.blade.php
index 95fe012eb..dfd8f3db5 100644
--- a/resources/views/emails/password.blade.php
+++ b/resources/views/emails/password.blade.php
@@ -1 +1 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">

<head style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
    <meta name="viewport" content="width=device-width" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" />
    <title>Password Reset From {{ Setting::get('app-name')}}</title>
    <style style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
        * {
        margin: 0;
        padding: 0;
        font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
        font-size: 100%;
        line-height: 1.6;
        }

        img {
        max-width: 100%;
        }

        body {
        -webkit-font-smoothing: antialiased;
        -webkit-text-size-adjust: none;
        width: 100%!important;
        height: 100%;
        }

        a {
        color: #348eda;
        }

        .btn-primary {
        text-decoration: none;
        color: #FFF;
        background-color: #348eda;
        border: solid #348eda;
        border-width: 10px 20px;
        line-height: 2;
        font-weight: bold;
        margin-right: 10px;
        text-align: center;
        cursor: pointer;
        display: inline-block;
        border-radius: 4px;
        }

        .btn-secondary {
        text-decoration: none;
        color: #FFF;
        background-color: #aaa;
        border: solid #aaa;
        border-width: 10px 20px;
        line-height: 2;
        font-weight: bold;
        margin-right: 10px;
        text-align: center;
        cursor: pointer;
        display: inline-block;
        border-radius: 25px;
        }

        .last {
        margin-bottom: 0;
        }

        .first {
        margin-top: 0;
        }

        .padding {
        padding: 10px 0;
        }

        table.body-wrap {
        width: 100%;
        padding: 20px;
        }

        table.body-wrap .container {
        border: 1px solid #f0f0f0;
        }

        h1,
        h2,
        h3 {
        font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
        color: #444;
        margin: 10px 0 10px;
        line-height: 1.2;
        font-weight: 200;
        }

        h1 {
        font-size: 36px;
        }

        h2 {
        font-size: 28px;
        }

        h3 {
        font-size: 22px;
        }

        p,
        ul,
        ol {
        margin-bottom: 10px;
        font-weight: normal;
        font-size: 14px;
        color: #888888;
        }

        ul li,
        ol li {
        margin-left: 5px;
        list-style-position: inside;
        }

        .container {
        display: block!important;
        max-width: 600px!important;
        margin: 0 auto!important;
        clear: both!important;
        }

        .body-wrap .container {
        padding: 20px;
        }

        .content {
        max-width: 600px;
        margin: 0 auto;
        display: block;
        }

        .content table {
        width: 100%;
        }
    </style>
    </head>

    <body bgcolor="#f6f6f6" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%;">
    <!-- body -->
    <table class="body-wrap" bgcolor="#f6f6f6" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;">
    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
    <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>
                                                                                                                                                                                                                                                  <td class="container" bgcolor="#FFFFFF" style="font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;display:block!important;max-width:600px!important;margin-top:0 !important;margin-bottom:0 !important;margin-right:auto !important;margin-left:auto !important;clear:both!important;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;border-width:1px;border-style:solid;border-color:#f0f0f0;">
    <!-- content -->
    <div class="content" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;display:block;">
    <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
    <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
    <h1 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;color:#444;margin-top:10px;margin-bottom:10px;margin-right:0;margin-left:0;line-height:1.2;font-weight:200;font-size:36px;">Password Reset</h1>
                                                                                                                                                                                                                                                                                                     <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">A password reset was requested for this email address on <a href="{{ url('/') }}">{{ Setting::get('app-name')}}</a>. If you did not request a password change please ignore this email.</p>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
    <td class="padding" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;">
    <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;"><a class="btn-primary" href="{{ url('password/reset/'.$token) }}" style="margin-top:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;text-decoration:none;color:#FFF;background-color:#348eda;border-style:solid;border-color:#348eda;border-width:10px 20px;line-height:2;font-weight:bold;margin-right:10px;text-align:center;cursor:pointer;display:inline-block;border-radius:4px;">Click here to reset your password</a></p>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      </td>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </tr>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          </table>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </td>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              </tr>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </table>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  </div>
    <!-- /content -->
    </td>
      <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>
                                                                                                                                                                                                                                                    </tr>
                                                                                                                                                                                                                                                      </table>
    <!-- /body -->
    </body>

      </html>
\ No newline at end of file
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">

<head style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
    <meta name="viewport" content="width=device-width"
          style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
          style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"/>
    <title>Password Reset From {{ setting('app-name')}}</title>
    <style style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
        * {
            margin: 0;
            padding: 0;
            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
            font-size: 100%;
            line-height: 1.6;
        }

        img {
            max-width: 100%;
        }

        body {
            -webkit-font-smoothing: antialiased;
            -webkit-text-size-adjust: none;
            width: 100% !important;
            height: 100%;
        }

        a {
            color: #348eda;
        }

        .btn-primary {
            text-decoration: none;
            color: #FFF;
            background-color: #348eda;
            border: solid #348eda;
            border-width: 10px 20px;
            line-height: 2;
            font-weight: bold;
            margin-right: 10px;
            text-align: center;
            cursor: pointer;
            display: inline-block;
            border-radius: 4px;
        }

        .btn-secondary {
            text-decoration: none;
            color: #FFF;
            background-color: #aaa;
            border: solid #aaa;
            border-width: 10px 20px;
            line-height: 2;
            font-weight: bold;
            margin-right: 10px;
            text-align: center;
            cursor: pointer;
            display: inline-block;
            border-radius: 25px;
        }

        .last {
            margin-bottom: 0;
        }

        .first {
            margin-top: 0;
        }

        .padding {
            padding: 10px 0;
        }

        table.body-wrap {
            width: 100%;
            padding: 20px;
        }

        table.body-wrap .container {
            border: 1px solid #f0f0f0;
        }

        h1,
        h2,
        h3 {
            font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
            color: #444;
            margin: 10px 0 10px;
            line-height: 1.2;
            font-weight: 200;
        }

        h1 {
            font-size: 36px;
        }

        h2 {
            font-size: 28px;
        }

        h3 {
            font-size: 22px;
        }

        p,
        ul,
        ol {
            margin-bottom: 10px;
            font-weight: normal;
            font-size: 14px;
            color: #888888;
        }

        ul li,
        ol li {
            margin-left: 5px;
            list-style-position: inside;
        }

        .container {
            display: block !important;
            max-width: 600px !important;
            margin: 0 auto !important;
            clear: both !important;
        }

        .body-wrap .container {
            padding: 20px;
        }

        .content {
            max-width: 600px;
            margin: 0 auto;
            display: block;
        }

        .content table {
            width: 100%;
        }
    </style>
</head>

<body bgcolor="#f6f6f6"
      style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%;">
<!-- body -->
<table class="body-wrap" bgcolor="#f6f6f6"
       style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;">
    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>
        <td class="container" bgcolor="#FFFFFF"
            style="font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;display:block!important;max-width:600px!important;margin-top:0 !important;margin-bottom:0 !important;margin-right:auto !important;margin-left:auto !important;clear:both!important;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;border-width:1px;border-style:solid;border-color:#f0f0f0;">
            <!-- content -->
            <div class="content"
                 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;display:block;">
                <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
                    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
                        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
                            <h1 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;color:#444;margin-top:10px;margin-bottom:10px;margin-right:0;margin-left:0;line-height:1.2;font-weight:200;font-size:36px;">
                                Password Reset</h1>
                            <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">
                                A password reset was requested for this email address on <a
                                        href="{{ baseUrl('/') }}">{{ setting('app-name')}}</a>. If you did not request
                                a password change please ignore this email.</p>
                            <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
                                <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
                                    <td class="padding"
                                        style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;">
                                        <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">
                                            <a class="btn-primary" href="{{ baseUrl('/password/reset/' . $token) }}"
                                               style="margin-top:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;text-decoration:none;color:#FFF;background-color:#348eda;border-style:solid;border-color:#348eda;border-width:10px 20px;line-height:2;font-weight:bold;margin-right:10px;text-align:center;cursor:pointer;display:inline-block;border-radius:4px;">Click
                                                here to reset your password</a></p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- /content -->
        </td>
        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>
    </tr>
</table>
<!-- /body -->
</body>

</html>
\ No newline at end of file
diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php
index a9294c7cf..19565bccb 100644
--- a/resources/views/errors/404.blade.php
+++ b/resources/views/errors/404.blade.php
@@ -6,7 +6,7 @@
 <div class="container">
     <h1 class="text-muted">{{ $message or 'Page Not Found' }}</h1>
     <p>Sorry, The page you were looking for could not be found.</p>
-    <a href="/" class="button">Return To Home</a>
+    <a href="{{ baseUrl('/') }}" class="button">Return To Home</a>
 </div>
 
 @stop
\ No newline at end of file
diff --git a/resources/views/errors/503.blade.php b/resources/views/errors/503.blade.php
index 0380666a8..c79d0f68b 100644
--- a/resources/views/errors/503.blade.php
+++ b/resources/views/errors/503.blade.php
@@ -1,47 +1,10 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>Be right back.</title>
+@extends('public')
 
-        <link href="//fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
+@section('content')
 
-        <style>
-            html, body {
-                height: 100%;
-            }
+    <div class="container">
+        <h1 class="text-muted">{{ setting('app-name') }} is down right now</h1>
+        <p>It will be back up soon.</p>
+    </div>
 
-            body {
-                margin: 0;
-                padding: 0;
-                width: 100%;
-                color: #B0BEC5;
-                display: table;
-                font-weight: 100;
-                font-family: 'Lato';
-            }
-
-            .container {
-                text-align: center;
-                display: table-cell;
-                vertical-align: middle;
-            }
-
-            .content {
-                text-align: center;
-                display: inline-block;
-            }
-
-            .title {
-                font-size: 72px;
-                margin-bottom: 40px;
-            }
-        </style>
-    </head>
-    <body>
-        <div class="container">
-            <div class="content">
-                <div class="title">Be right back.</div>
-            </div>
-        </div>
-    </body>
-</html>
+@stop
\ No newline at end of file
diff --git a/resources/views/form/restriction-form.blade.php b/resources/views/form/restriction-form.blade.php
index f61a535e7..7472fe65e 100644
--- a/resources/views/form/restriction-form.blade.php
+++ b/resources/views/form/restriction-form.blade.php
@@ -1,4 +1,4 @@
-<form action="{{ $model->getUrl() }}/permissions" method="POST">
+<form action="{{ $model->getUrl('/permissions') }}" method="POST">
     {!! csrf_field() !!}
     <input type="hidden" name="_method" value="PUT">
 
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php
index 88319738e..2529c39c7 100644
--- a/resources/views/home.blade.php
+++ b/resources/views/home.blade.php
@@ -42,7 +42,7 @@
             </div>
 
             <div class="col-sm-4">
-                <h3><a class="no-color" href="/pages/recently-created">Recently Created Pages</a></h3>
+                <h3><a class="no-color" href="{{ baseUrl("/pages/recently-created") }}">Recently Created Pages</a></h3>
                 <div id="recently-created-pages">
                     @include('partials/entity-list', [
                     'entities' => $recentlyCreatedPages,
@@ -51,7 +51,7 @@
                     ])
                 </div>
 
-                <h3><a class="no-color" href="/pages/recently-updated">Recently Updated Pages</a></h3>
+                <h3><a class="no-color" href="{{ baseUrl("/pages/recently-updated") }}">Recently Updated Pages</a></h3>
                 <div id="recently-updated-pages">
                     @include('partials/entity-list', [
                     'entities' => $recentlyUpdatedPages,
diff --git a/resources/views/pages/delete.blade.php b/resources/views/pages/delete.blade.php
index 5a9b32c06..57cc86054 100644
--- a/resources/views/pages/delete.blade.php
+++ b/resources/views/pages/delete.blade.php
@@ -6,10 +6,10 @@
         <h1>Delete {{ $page->draft ? 'Draft' : '' }} Page</h1>
         <p class="text-neg">Are you sure you want to delete this {{ $page->draft ? 'draft' : '' }} page?</p>
 
-        <form action="{{$page->getUrl()}}" method="POST">
+        <form action="{{ $page->getUrl() }}" method="POST">
             {!! csrf_field() !!}
             <input type="hidden" name="_method" value="DELETE">
-            <a href="{{$page->getUrl()}}" class="button primary">Cancel</a>
+            <a href="{{ $page->getUrl() }}" class="button primary">Cancel</a>
             <button type="submit" class="button neg">Confirm</button>
         </form>
     </div>
diff --git a/resources/views/pages/edit.blade.php b/resources/views/pages/edit.blade.php
index de6051118..9fe6a6a19 100644
--- a/resources/views/pages/edit.blade.php
+++ b/resources/views/pages/edit.blade.php
@@ -1,7 +1,7 @@
 @extends('base')
 
 @section('head')
-    <script src="/libs/tinymce/tinymce.min.js?ver=4.3.7"></script>
+    <script src="{{ baseUrl('/libs/tinymce/tinymce.min.js?ver=4.3.7') }}"></script>
 @stop
 
 @section('body-class', 'flexbox')
@@ -9,7 +9,7 @@
 @section('content')
 
     <div class="flex-fill flex">
-        <form action="{{$page->getUrl()}}" autocomplete="off" data-page-id="{{ $page->id }}" method="POST" class="flex flex-fill">
+        <form action="{{ $page->getUrl() }}" autocomplete="off" data-page-id="{{ $page->id }}" method="POST" class="flex flex-fill">
             @if(!isset($isDraft))
                 <input type="hidden" name="_method" value="PUT">
             @endif
diff --git a/resources/views/pages/form-toolbox.blade.php b/resources/views/pages/form-toolbox.blade.php
index b3fcd7c13..a03a208b6 100644
--- a/resources/views/pages/form-toolbox.blade.php
+++ b/resources/views/pages/form-toolbox.blade.php
@@ -14,8 +14,8 @@
                 <tbody ui-sortable="sortOptions" ng-model="tags" >
                     <tr ng-repeat="tag in tags track by $index">
                         <td width="20" ><i class="handle zmdi zmdi-menu"></i></td>
-                        <td><input autosuggest="/ajax/tags/suggest/names" autosuggest-type="name" class="outline" ng-attr-name="tags[@{{$index}}][name]" type="text" ng-model="tag.name" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag"></td>
-                        <td><input autosuggest="/ajax/tags/suggest/values" autosuggest-type="value" class="outline" ng-attr-name="tags[@{{$index}}][value]" type="text" ng-model="tag.value" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag Value (Optional)"></td>
+                        <td><input autosuggest="{{ baseUrl('/ajax/tags/suggest/names') }}" autosuggest-type="name" class="outline" ng-attr-name="tags[@{{$index}}][name]" type="text" ng-model="tag.name" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag"></td>
+                        <td><input autosuggest="{{ baseUrl('/ajax/tags/suggest/values') }}" autosuggest-type="value" class="outline" ng-attr-name="tags[@{{$index}}][value]" type="text" ng-model="tag.value" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag Value (Optional)"></td>
                         <td width="10" ng-show="tags.length != 1" class="text-center text-neg" style="padding: 0;" ng-click="removeTag(tag)"><i class="zmdi zmdi-close"></i></td>
                     </tr>
                 </tbody>
diff --git a/resources/views/pages/form.blade.php b/resources/views/pages/form.blade.php
index 6529f044b..18a9868c7 100644
--- a/resources/views/pages/form.blade.php
+++ b/resources/views/pages/form.blade.php
@@ -20,7 +20,7 @@
                                 <a ng-click="forceDraftSave()" class="text-pos"><i class="zmdi zmdi-save"></i>Save Draft</a>
                             </li>
                             <li ng-if="isNewPageDraft">
-                                <a href="{{$model->getUrl()}}/delete" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete Draft</a>
+                                <a href="{{ $model->getUrl('/delete') }}" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete Draft</a>
                             </li>
                         </ul>
                     </div>
diff --git a/resources/views/pages/move.blade.php b/resources/views/pages/move.blade.php
index 27ee4cd92..d0fae60ca 100644
--- a/resources/views/pages/move.blade.php
+++ b/resources/views/pages/move.blade.php
@@ -7,16 +7,16 @@
             <div class="row">
                 <div class="col-sm-12 faded">
                     <div class="breadcrumbs">
-                        <a href="{{$book->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
+                        <a href="{{ $book->getUrl() }}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
                         @if($page->hasChapter())
                             <span class="sep">&raquo;</span>
                             <a href="{{ $page->chapter->getUrl() }}" class="text-chapter text-button">
                                 <i class="zmdi zmdi-collection-bookmark"></i>
-                                {{$page->chapter->getShortName()}}
+                                {{ $page->chapter->getShortName() }}
                             </a>
                         @endif
                         <span class="sep">&raquo;</span>
-                        <a href="{{$page->getUrl()}}" class="text-page text-button"><i class="zmdi zmdi-file-text"></i>{{ $page->getShortName() }}</a>
+                        <a href="{{ $page->getUrl() }}" class="text-page text-button"><i class="zmdi zmdi-file-text"></i>{{ $page->getShortName() }}</a>
                     </div>
                 </div>
             </div>
@@ -26,7 +26,7 @@
     <div class="container">
         <h1>Move Page <small class="subheader">{{$page->name}}</small></h1>
 
-        <form action="{{ $page->getUrl() }}/move" method="POST">
+        <form action="{{ $page->getUrl('/move') }}" method="POST">
             {!! csrf_field() !!}
             <input type="hidden" name="_method" value="PUT">
 
diff --git a/resources/views/pages/page-display.blade.php b/resources/views/pages/page-display.blade.php
index d0bdcf880..11bcddcfc 100644
--- a/resources/views/pages/page-display.blade.php
+++ b/resources/views/pages/page-display.blade.php
@@ -8,8 +8,8 @@
             <table>
                 @foreach($page->tags as $tag)
                     <tr class="tag">
-                        <td @if(!$tag->value) colspan="2" @endif><a href="/search/all?term=%5B{{ urlencode($tag->name) }}%5D">{{ $tag->name }}</a></td>
-                        @if($tag->value) <td class="tag-value"><a href="/search/all?term=%5B{{ urlencode($tag->name) }}%3D{{ urlencode($tag->value) }}%5D">{{$tag->value}}</a></td> @endif
+                        <td @if(!$tag->value) colspan="2" @endif><a href="{{ baseUrl('/search/all?term=%5B' . urlencode($tag->name) .'%5D') }}">{{ $tag->name }}</a></td>
+                        @if($tag->value) <td class="tag-value"><a href="{{ baseUrl('/search/all?term=%5B' . urlencode($tag->name) .'%3D' . urlencode($tag->value) . '%5D') }}">{{$tag->value}}</a></td> @endif
                     </tr>
                 @endforeach
             </table>
diff --git a/resources/views/pages/restrictions.blade.php b/resources/views/pages/restrictions.blade.php
index 09eb8a65b..8eca486c3 100644
--- a/resources/views/pages/restrictions.blade.php
+++ b/resources/views/pages/restrictions.blade.php
@@ -7,16 +7,16 @@
             <div class="row">
                 <div class="col-sm-12 faded">
                     <div class="breadcrumbs">
-                        <a href="{{$page->book->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $page->book->getShortName() }}</a>
+                        <a href="{{ $page->book->getUrl() }}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $page->book->getShortName() }}</a>
                         @if($page->hasChapter())
                             <span class="sep">&raquo;</span>
                             <a href="{{ $page->chapter->getUrl() }}" class="text-chapter text-button">
                                 <i class="zmdi zmdi-collection-bookmark"></i>
-                                {{$page->chapter->getShortName()}}
+                                {{ $page->chapter->getShortName() }}
                             </a>
                         @endif
                         <span class="sep">&raquo;</span>
-                        <a href="{{$page->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-file"></i>{{ $page->getShortName() }}</a>
+                        <a href="{{ $page->getUrl() }}" class="text-book text-button"><i class="zmdi zmdi-file"></i>{{ $page->getShortName() }}</a>
                     </div>
                 </div>
             </div>
diff --git a/resources/views/pages/revisions.blade.php b/resources/views/pages/revisions.blade.php
index a73f16a4f..03fb23673 100644
--- a/resources/views/pages/revisions.blade.php
+++ b/resources/views/pages/revisions.blade.php
@@ -7,7 +7,7 @@
             <div class="row">
                 <div class="col-md-6 faded">
                     <div class="breadcrumbs">
-                        <a href="{{$page->getUrl()}}" class="text-primary text-button"><i class="zmdi zmdi-arrow-left"></i>Back to page</a>
+                        <a href="{{ $page->getUrl() }}" class="text-primary text-button"><i class="zmdi zmdi-arrow-left"></i>Back to page</a>
                     </div>
                 </div>
                 <div class="col-md-6 faded">
@@ -40,9 +40,9 @@
                         <td> @if($revision->createdBy) {{$revision->createdBy->name}} @else Deleted User @endif</td>
                         <td><small>{{$revision->created_at->format('jS F, Y H:i:s')}} <br> ({{$revision->created_at->diffForHumans()}})</small></td>
                         <td>
-                            <a href="{{$revision->getUrl()}}" target="_blank">Preview</a>
+                            <a href="{{ $revision->getUrl() }}" target="_blank">Preview</a>
                             <span class="text-muted">&nbsp;|&nbsp;</span>
-                            <a href="{{$revision->getUrl()}}/restore">Restore</a>
+                            <a href="{{ $revision->getUrl('/restore') }}">Restore</a>
                         </td>
                     </tr>
                 @endforeach
diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.php
index f12ba58c6..9d6b74a03 100644
--- a/resources/views/pages/show.blade.php
+++ b/resources/views/pages/show.blade.php
@@ -7,12 +7,12 @@
             <div class="row">
                 <div class="col-sm-6 faded">
                     <div class="breadcrumbs">
-                        <a href="{{$book->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
+                        <a href="{{ $book->getUrl() }}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
                         @if($page->hasChapter())
                             <span class="sep">&raquo;</span>
                             <a href="{{ $page->chapter->getUrl() }}" class="text-chapter text-button">
                                 <i class="zmdi zmdi-collection-bookmark"></i>
-                                {{$page->chapter->getShortName()}}
+                                {{ $page->chapter->getShortName() }}
                             </a>
                         @endif
                     </div>
@@ -22,27 +22,27 @@
                         <span dropdown class="dropdown-container">
                             <div dropdown-toggle class="text-button text-primary"><i class="zmdi zmdi-open-in-new"></i>Export</div>
                             <ul class="wide">
-                                <li><a href="{{$page->getUrl()}}/export/html" target="_blank">Contained Web File <span class="text-muted float right">.html</span></a></li>
-                                <li><a href="{{$page->getUrl()}}/export/pdf" target="_blank">PDF File <span class="text-muted float right">.pdf</span></a></li>
-                                <li><a href="{{$page->getUrl()}}/export/plaintext" target="_blank">Plain Text File <span class="text-muted float right">.txt</span></a></li>
+                                <li><a href="{{ $page->getUrl('/export/html') }}" target="_blank">Contained Web File <span class="text-muted float right">.html</span></a></li>
+                                <li><a href="{{ $page->getUrl('/export/pdf') }}" target="_blank">PDF File <span class="text-muted float right">.pdf</span></a></li>
+                                <li><a href="{{ $page->getUrl('/export/plaintext') }}" target="_blank">Plain Text File <span class="text-muted float right">.txt</span></a></li>
                             </ul>
                         </span>
                         @if(userCan('page-update', $page))
-                            <a href="{{$page->getUrl()}}/edit" class="text-primary text-button" ><i class="zmdi zmdi-edit"></i>Edit</a>
+                            <a href="{{ $page->getUrl('/edit') }}" class="text-primary text-button" ><i class="zmdi zmdi-edit"></i>Edit</a>
                         @endif
                         @if(userCan('page-update', $page) || userCan('restrictions-manage', $page) || userCan('page-delete', $page))
                             <div dropdown class="dropdown-container">
                                 <a dropdown-toggle class="text-primary text-button"><i class="zmdi zmdi-more-vert"></i></a>
                                 <ul>
                                     @if(userCan('page-update', $page))
-                                        <li><a href="{{$page->getUrl()}}/move" class="text-primary" ><i class="zmdi zmdi-folder"></i>Move</a></li>
-                                        <li><a href="{{$page->getUrl()}}/revisions" class="text-primary"><i class="zmdi zmdi-replay"></i>Revisions</a></li>
+                                        <li><a href="{{ $page->getUrl('/move') }}" class="text-primary" ><i class="zmdi zmdi-folder"></i>Move</a></li>
+                                        <li><a href="{{ $page->getUrl('/revisions') }}" class="text-primary"><i class="zmdi zmdi-replay"></i>Revisions</a></li>
                                     @endif
                                     @if(userCan('restrictions-manage', $page))
-                                        <li><a href="{{$page->getUrl()}}/permissions" class="text-primary"><i class="zmdi zmdi-lock-outline"></i>Permissions</a></li>
+                                        <li><a href="{{ $page->getUrl('/permissions') }}" class="text-primary"><i class="zmdi zmdi-lock-outline"></i>Permissions</a></li>
                                     @endif
                                     @if(userCan('page-delete', $page))
-                                        <li><a href="{{$page->getUrl()}}/delete" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a></li>
+                                        <li><a href="{{ $page->getUrl('/delete') }}" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a></li>
                                     @endif
                                 </ul>
                             </div>
@@ -73,13 +73,14 @@
                     <hr>
 
                     <p class="text-muted small">
-                        Created {{$page->created_at->diffForHumans()}} @if($page->createdBy) by <a href="/user/{{ $page->createdBy->id }}">{{$page->createdBy->name}}</a> @endif
+                        Created {{ $page->created_at->diffForHumans() }} @if($page->createdBy) by <a href="{{ $page->createdBy->getProfileUrl() }}">{{$page->createdBy->name}}</a> @endif
                         <br>
-                        Last Updated {{$page->updated_at->diffForHumans()}} @if($page->updatedBy) by <a href="/user/{{ $page->updatedBy->id }}">{{$page->updatedBy->name}}</a> @endif
+                        Last Updated {{ $page->updated_at->diffForHumans() }} @if($page->updatedBy) by <a href="{{ $page->updatedBy->getProfileUrl() }}">{{$page->updatedBy->name}}</a> @endif
                     </p>
 
                 </div>
             </div>
+
             <div class="col-md-3 print-hidden">
                 <div class="margin-top large"></div>
                 @if($book->restricted || ($page->chapter && $page->chapter->restricted) || $page->restricted)
@@ -87,7 +88,7 @@
 
                         @if($book->restricted)
                             @if(userCan('restrictions-manage', $book))
-                                <a href="{{ $book->getUrl() }}/permissions"><i class="zmdi zmdi-lock-outline"></i>Book Permissions Active</a>
+                                <a href="{{ $book->getUrl('/permissions') }}"><i class="zmdi zmdi-lock-outline"></i>Book Permissions Active</a>
                             @else
                                 <i class="zmdi zmdi-lock-outline"></i>Book Permissions Active
                             @endif
@@ -96,7 +97,7 @@
 
                         @if($page->chapter && $page->chapter->restricted)
                             @if(userCan('restrictions-manage', $page->chapter))
-                                <a href="{{ $page->chapter->getUrl() }}/permissions"><i class="zmdi zmdi-lock-outline"></i>Chapter Permissions Active</a>
+                                <a href="{{ $page->chapter->getUrl('/permissions') }}"><i class="zmdi zmdi-lock-outline"></i>Chapter Permissions Active</a>
                             @else
                                 <i class="zmdi zmdi-lock-outline"></i>Chapter Permissions Active
                             @endif
@@ -105,7 +106,7 @@
 
                         @if($page->restricted)
                             @if(userCan('restrictions-manage', $page))
-                                <a href="{{ $page->getUrl() }}/permissions"><i class="zmdi zmdi-lock-outline"></i>Page Permissions Active</a>
+                                <a href="{{ $page->getUrl('/permissions') }}"><i class="zmdi zmdi-lock-outline"></i>Page Permissions Active</a>
                             @else
                                 <i class="zmdi zmdi-lock-outline"></i>Page Permissions Active
                             @endif
@@ -114,8 +115,8 @@
                     </div>
                 @endif
                 @include('pages/sidebar-tree-list', ['book' => $book, 'sidebarTree' => $sidebarTree])
-
             </div>
+
         </div>
     </div>
 
diff --git a/resources/views/pages/sidebar-tree-list.blade.php b/resources/views/pages/sidebar-tree-list.blade.php
index 3445acbdc..e40fdbf0f 100644
--- a/resources/views/pages/sidebar-tree-list.blade.php
+++ b/resources/views/pages/sidebar-tree-list.blade.php
@@ -2,12 +2,12 @@
 <div class="book-tree" ng-non-bindable>
     <h6 class="text-muted">Book Navigation</h6>
     <ul class="sidebar-page-list menu">
-        <li class="book-header"><a href="{{$book->getUrl()}}" class="book {{ $current->matches($book)? 'selected' : '' }}"><i class="zmdi zmdi-book"></i>{{$book->name}}</a></li>
+        <li class="book-header"><a href="{{ $book->getUrl() }}" class="book {{ $current->matches($book)? 'selected' : '' }}"><i class="zmdi zmdi-book"></i>{{$book->name}}</a></li>
 
 
         @foreach($sidebarTree as $bookChild)
             <li class="list-item-{{ $bookChild->getClassName() }} {{ $bookChild->getClassName() }} {{ $bookChild->isA('page') && $bookChild->draft ? 'draft' : '' }}">
-                <a href="{{$bookChild->getUrl()}}" class="{{ $bookChild->getClassName() }} {{ $current->matches($bookChild)? 'selected' : '' }}">
+                <a href="{{ $bookChild->getUrl() }}" class="{{ $bookChild->getClassName() }} {{ $current->matches($bookChild)? 'selected' : '' }}">
                     @if($bookChild->isA('chapter'))<i class="zmdi zmdi-collection-bookmark"></i>@else <i class="zmdi zmdi-file-text"></i>@endif{{ $bookChild->name }}
                 </a>
 
@@ -18,7 +18,7 @@
                     <ul class="menu sub-menu inset-list @if($bookChild->matchesOrContains($current)) open @endif">
                         @foreach($bookChild->pages as $childPage)
                             <li class="list-item-page {{ $childPage->isA('page') && $childPage->draft ? 'draft' : '' }}">
-                                <a href="{{$childPage->getUrl()}}" class="page {{ $current->matches($childPage)? 'selected' : '' }}">
+                                <a href="{{ $childPage->getUrl() }}" class="page {{ $current->matches($childPage)? 'selected' : '' }}">
                                     <i class="zmdi zmdi-file-text"></i> {{ $childPage->name }}
                                 </a>
                             </li>
diff --git a/resources/views/partials/activity-item.blade.php b/resources/views/partials/activity-item.blade.php
index ff0d74586..c45ca6c7a 100644
--- a/resources/views/partials/activity-item.blade.php
+++ b/resources/views/partials/activity-item.blade.php
@@ -3,13 +3,13 @@
 
 @if($activity->user)
     <div class="left">
-        <img class="avatar" src="{{ $activity->user->getAvatar(30) }}" alt="{{$activity->user->name}}">
+        <img class="avatar" src="{{ $activity->user->getAvatar(30) }}" alt="{{ $activity->user->name }}">
     </div>
 @endif
 
 <div class="right" ng-non-bindable>
     @if($activity->user)
-        <a href="/user/{{ $activity->user->id }}">{{$activity->user->name}}</a>
+        <a href="{{ $activity->user->getProfileUrl() }}">{{ $activity->user->name }}</a>
     @else
         A deleted user
     @endif
@@ -20,7 +20,7 @@
         <a href="{{ $activity->entity->getUrl() }}">{{ $activity->entity->name }}</a>
     @endif
 
-    @if($activity->extra) "{{$activity->extra}}" @endif
+    @if($activity->extra) "{{ $activity->extra }}" @endif
 
     <br>
 
diff --git a/resources/views/partials/custom-styles.blade.php b/resources/views/partials/custom-styles.blade.php
index 2e23e267b..bf7dde1d4 100644
--- a/resources/views/partials/custom-styles.blade.php
+++ b/resources/views/partials/custom-styles.blade.php
@@ -1,20 +1,20 @@
 <style>
     header, #back-to-top, .primary-background {
-        background-color: {{ Setting::get('app-color') }} !important;
+        background-color: {{ setting('app-color') }} !important;
     }
     .faded-small, .primary-background-light {
-        background-color: {{ Setting::get('app-color-light') }};
+        background-color: {{ setting('app-color-light') }};
     }
     .button-base, .button, input[type="button"], input[type="submit"] {
-        background-color: {{ Setting::get('app-color') }};
+        background-color: {{ setting('app-color') }};
     }
     .button-base:hover, .button:hover, input[type="button"]:hover, input[type="submit"]:hover, .button:focus {
-        background-color: {{ Setting::get('app-color') }};
+        background-color: {{ setting('app-color') }};
     }
     .nav-tabs a.selected, .nav-tabs .tab-item.selected {
-        border-bottom-color: {{ Setting::get('app-color') }};
+        border-bottom-color: {{ setting('app-color') }};
     }
     p.primary:hover, p .primary:hover, span.primary:hover, .text-primary:hover, a, a:hover, a:focus, .text-button, .text-button:hover, .text-button:focus {
-        color: {{ Setting::get('app-color') }};
+        color: {{ setting('app-color') }};
     }
 </style>
\ No newline at end of file
diff --git a/resources/views/partials/highlight.blade.php b/resources/views/partials/highlight.blade.php
index ec8d54226..4c1ded9d2 100644
--- a/resources/views/partials/highlight.blade.php
+++ b/resources/views/partials/highlight.blade.php
@@ -1,5 +1,5 @@
 
-<script src="/libs/highlightjs/highlight.min.js"></script>
+<script src="{{ baseUrl('/libs/highlightjs/highlight.min.js') }}"></script>
 <script>
     $(function() {
         var aCodes = document.getElementsByTagName('pre');
diff --git a/resources/views/public.blade.php b/resources/views/public.blade.php
index f22fd47d4..2de4d968a 100644
--- a/resources/views/public.blade.php
+++ b/resources/views/public.blade.php
@@ -1,20 +1,21 @@
 <!DOCTYPE html>
 <html>
 <head>
-    <title>BookStack</title>
+    <title>{{ setting('app-name') }}</title>
 
     <!-- Meta -->
     <meta name="viewport" content="width=device-width">
     <meta name="token" content="{{ csrf_token() }}">
+    <meta name="base-url" content="{{ baseUrl('/') }}">
     <meta charset="utf-8">
 
     <!-- Styles and Fonts -->
     <link rel="stylesheet" href="{{ versioned_asset('css/styles.css') }}">
     <link rel="stylesheet" media="print" href="{{ versioned_asset('css/print-styles.css') }}">
-    <link rel="stylesheet" href="/libs/material-design-iconic-font/css/material-design-iconic-font.min.css">
+    <link rel="stylesheet" href="{{ baseUrl("/libs/material-design-iconic-font/css/material-design-iconic-font.min.css") }}">
 
     <!-- Scripts -->
-    <script src="/libs/jquery/jquery.min.js?version=2.1.4"></script>
+    <script src="{{ baseUrl("/libs/jquery/jquery.min.js?version=2.1.4") }}"></script>
     @include('partials/custom-styles')
 </head>
 <body class="@yield('body-class')" ng-app="bookStack">
@@ -26,9 +27,11 @@
         <div class="row">
             <div class="col-md-6">
 
-                <a href="/" class="logo">
-                    <img class="logo-image" src="/logo.png" alt="Logo">
-                    <span class="logo-text">{{ Setting::get('app-name', 'BookStack') }}</span>
+                <a href="{{ baseUrl('/') }}" class="logo">
+                    @if(setting('app-logo', '') !== 'none')
+                        <img class="logo-image" src="{{ setting('app-logo', '') === '' ? baseUrl('/logo.png') : baseUrl(setting('app-logo', '')) }}" alt="Logo">
+                    @endif
+                    <span class="logo-text">{{ setting('app-name') }}</span>
                 </a>
             </div>
             <div class="col-md-6">
@@ -38,16 +41,19 @@
                     </div>
                     @if(isset($signedIn) && $signedIn)
                         <div class="dropdown-container" dropdown>
-                                <span class="user-name" dropdown-toggle>
-                                    <img class="avatar" src="{{$currentUser->getAvatar(30)}}" alt="{{ $currentUser->name }}">
-                                    <span class="name" ng-non-bindable>{{ $currentUser->name }}</span> <i class="zmdi zmdi-caret-down"></i>
-                                </span>
+                            <span class="user-name" dropdown-toggle>
+                                <img class="avatar" src="{{$currentUser->getAvatar(30)}}" alt="{{ $currentUser->name }}">
+                                <span class="name" ng-non-bindable>{{ $currentUser->getShortName(9) }}</span> <i class="zmdi zmdi-caret-down"></i>
+                            </span>
                             <ul>
                                 <li>
-                                    <a href="/users/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-edit zmdi-hc-lg"></i>Edit Profile</a>
+                                    <a href="{{ baseUrl("/user/{$currentUser->id}") }}" class="text-primary"><i class="zmdi zmdi-account zmdi-hc-fw zmdi-hc-lg"></i>View Profile</a>
                                 </li>
                                 <li>
-                                    <a href="/logout" class="text-neg"><i class="zmdi zmdi-run zmdi-hc-lg"></i>Logout</a>
+                                    <a href="{{ baseUrl("/settings/users/{$currentUser->id}") }}" class="text-primary"><i class="zmdi zmdi-edit zmdi-hc-fw zmdi-hc-lg"></i>Edit Profile</a>
+                                </li>
+                                <li>
+                                    <a href="{{ baseUrl('/logout') }}" class="text-neg"><i class="zmdi zmdi-run zmdi-hc-fw zmdi-hc-lg"></i>Logout</a>
                                 </li>
                             </ul>
                         </div>
diff --git a/resources/views/search/all.blade.php b/resources/views/search/all.blade.php
index c2ba34145..fcfb2c902 100644
--- a/resources/views/search/all.blade.php
+++ b/resources/views/search/all.blade.php
@@ -4,41 +4,41 @@
 
     <div class="container anim fadeIn" ng-non-bindable>
 
-        <h1>Search Results&nbsp;&nbsp;&nbsp; <span class="text-muted">{{$searchTerm}}</span></h1>
+        <h1>Search Results&nbsp;&nbsp;&nbsp; <span class="text-muted">{{ $searchTerm }}</span></h1>
 
         <p>
 
             @if(count($pages) > 0)
-                <a href="/search/pages?term={{$searchTerm}}" class="text-page"><i class="zmdi zmdi-file-text"></i>View all matched pages</a>
+                <a href="{{ baseUrl("/search/pages?term={$searchTerm}") }}" class="text-page"><i class="zmdi zmdi-file-text"></i>View all matched pages</a>
             @endif
 
 
             @if(count($chapters) > 0)
                 &nbsp; &nbsp;&nbsp;
-                <a href="/search/chapters?term={{$searchTerm}}" class="text-chapter"><i class="zmdi zmdi-collection-bookmark"></i>View all matched chapters</a>
+                <a href="{{ baseUrl("/search/chapters?term={$searchTerm}") }}" class="text-chapter"><i class="zmdi zmdi-collection-bookmark"></i>View all matched chapters</a>
             @endif
 
             @if(count($books) > 0)
                 &nbsp; &nbsp;&nbsp;
-                <a href="/search/books?term={{$searchTerm}}" class="text-book"><i class="zmdi zmdi-book"></i>View all matched books</a>
+                <a href="{{ baseUrl("/search/books?term={$searchTerm}") }}" class="text-book"><i class="zmdi zmdi-book"></i>View all matched books</a>
             @endif
         </p>
         <div class="row">
 
             <div class="col-md-6">
-                <h3><a href="/search/pages?term={{$searchTerm}}" class="no-color">Matching Pages</a></h3>
+                <h3><a href="{{ baseUrl("/search/pages?term={$searchTerm}") }}" class="no-color">Matching Pages</a></h3>
                 @include('partials/entity-list', ['entities' => $pages, 'style' => 'detailed'])
             </div>
 
             <div class="col-md-5 col-md-offset-1">
 
                 @if(count($books) > 0)
-                    <h3><a href="/search/books?term={{$searchTerm}}" class="no-color">Matching Books</a></h3>
+                    <h3><a href="{{ baseUrl("/search/books?term={$searchTerm}") }}" class="no-color">Matching Books</a></h3>
                     @include('partials/entity-list', ['entities' => $books])
                 @endif
 
                 @if(count($chapters) > 0)
-                    <h3><a href="/search/chapters?term={{$searchTerm}}" class="no-color">Matching Chapters</a></h3>
+                    <h3><a href="{{ baseUrl("/search/chapters?term={$searchTerm}") }}" class="no-color">Matching Chapters</a></h3>
                     @include('partials/entity-list', ['entities' => $chapters])
                 @endif
 
diff --git a/resources/views/search/entity-search-list.blade.php b/resources/views/search/entity-search-list.blade.php
index 5ca6492ef..dd9c6a509 100644
--- a/resources/views/search/entity-search-list.blade.php
+++ b/resources/views/search/entity-search-list.blade.php
@@ -6,7 +6,7 @@
         <div class="row">
 
             <div class="col-sm-7">
-                <h1>{{ $title }} <small>{{$searchTerm}}</small></h1>
+                <h1>{{ $title }} <small>{{ $searchTerm }}</small></h1>
                 @include('partials.entity-list', ['entities' => $entities, 'style' => 'detailed'])
                 {!! $entities->links() !!}
             </div>
diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php
index 1e76c1675..222ff0f69 100644
--- a/resources/views/settings/index.blade.php
+++ b/resources/views/settings/index.blade.php
@@ -8,7 +8,7 @@
 
     <h1>Settings</h1>
 
-    <form action="/settings" method="POST" ng-cloak>
+    <form action="{{ baseUrl("/settings") }}" method="POST" ng-cloak>
         {!! csrf_field() !!}
 
         <h3>App Settings</h3>
@@ -41,7 +41,7 @@
                 <div class="form-group" id="logo-control">
                     <label for="setting-app-logo">Application logo</label>
                     <p class="small">This image should be 43px in height. <br>Large images will be scaled down.</p>
-                    <image-picker resize-height="43" show-remove="true" resize-width="200" current-image="{{ setting('app-logo', '') }}" default-image="/logo.png" name="setting-app-logo" image-class="logo-image"></image-picker>
+                    <image-picker resize-height="43" show-remove="true" resize-width="200" current-image="{{ setting('app-logo', '') }}" default-image="{{ baseUrl('/logo.png') }}" name="setting-app-logo" image-class="logo-image"></image-picker>
                 </div>
                 <div class="form-group" id="color-control">
                     <label for="setting-app-color">Application primary color</label>
@@ -112,7 +112,7 @@
 @stop
 
 @section('scripts')
-    <script src="/libs/jq-color-picker/tiny-color-picker.min.js?version=1.0.0"></script>
+    <script src="{{ baseUrl("/libs/jq-color-picker/tiny-color-picker.min.js?version=1.0.0") }}"></script>
     <script type="text/javascript">
         $('#setting-app-color').colorPicker({
             opacity: false,
@@ -125,9 +125,9 @@
                 if (!isEmpty) $elm.val(hexVal);
                 $('#setting-app-color-light').val(isEmpty ? '' : rgbLightVal);
                 // Set page elements to provide preview
-                $('#header, .image-picker .button').css('background-color', hexVal);
+                $('#header, .image-picker .button').attr('style', 'background-color:'+ hexVal+'!important;');
                 $('.faded-small').css('background-color', rgbLightVal);
-                $('.setting-nav a.selected').css('border-bottom-color', hexVal);
+                $('.setting-nav a.selected').css('border-bottom-color', hexVal  + '!important');
             }
         });
     </script>
diff --git a/resources/views/settings/navbar.blade.php b/resources/views/settings/navbar.blade.php
index b656f5b36..f4526b4c8 100644
--- a/resources/views/settings/navbar.blade.php
+++ b/resources/views/settings/navbar.blade.php
@@ -4,13 +4,13 @@
         <div class="row">
             <div class="col-md-12 setting-nav nav-tabs">
                 @if($currentUser->can('settings-manage'))
-                    <a href="/settings" @if($selected == 'settings') class="selected text-button" @endif><i class="zmdi zmdi-settings"></i>Settings</a>
+                    <a href="{{ baseUrl('/settings') }}" @if($selected == 'settings') class="selected text-button" @endif><i class="zmdi zmdi-settings"></i>Settings</a>
                 @endif
                 @if($currentUser->can('users-manage'))
-                    <a href="/settings/users" @if($selected == 'users') class="selected text-button" @endif><i class="zmdi zmdi-accounts"></i>Users</a>
+                    <a href="{{ baseUrl('/settings/users') }}" @if($selected == 'users') class="selected text-button" @endif><i class="zmdi zmdi-accounts"></i>Users</a>
                 @endif
                 @if($currentUser->can('user-roles-manage'))
-                    <a href="/settings/roles" @if($selected == 'roles') class="selected text-button" @endif><i class="zmdi zmdi-lock-open"></i>Roles</a>
+                    <a href="{{ baseUrl('/settings/roles') }}" @if($selected == 'roles') class="selected text-button" @endif><i class="zmdi zmdi-lock-open"></i>Roles</a>
                 @endif
             </div>
         </div>
diff --git a/resources/views/settings/roles/create.blade.php b/resources/views/settings/roles/create.blade.php
index f7d39f454..6a59c0c54 100644
--- a/resources/views/settings/roles/create.blade.php
+++ b/resources/views/settings/roles/create.blade.php
@@ -7,7 +7,7 @@
     <div class="container">
         <h1>Create New Role</h1>
 
-        <form action="/settings/roles/new" method="POST">
+        <form action="{{ baseUrl("/settings/roles/new") }}" method="POST">
             @include('settings/roles/form')
         </form>
     </div>
diff --git a/resources/views/settings/roles/delete.blade.php b/resources/views/settings/roles/delete.blade.php
index 5d1ffe259..1377d07ae 100644
--- a/resources/views/settings/roles/delete.blade.php
+++ b/resources/views/settings/roles/delete.blade.php
@@ -6,9 +6,9 @@
 
     <div class="container small" ng-non-bindable>
         <h1>Delete Role</h1>
-        <p>This will delete the role with the name '{{$role->display_name}}'.</p>
+        <p>This will delete the role with the name '{{ $role->display_name }}'.</p>
 
-        <form action="/settings/roles/delete/{{$role->id}}" method="POST">
+        <form action="{{ baseUrl("/settings/roles/delete/{$role->id}") }}" method="POST">
             {!! csrf_field() !!}
             <input type="hidden" name="_method" value="DELETE">
 
@@ -20,7 +20,7 @@
             @endif
 
             <p class="text-neg">Are you sure you want to delete this role?</p>
-            <a href="/settings/roles/{{ $role->id }}" class="button">Cancel</a>
+            <a href="{{ baseUrl("/settings/roles/{$role->id}") }}" class="button">Cancel</a>
             <button type="submit" class="button neg">Confirm</button>
         </form>
     </div>
diff --git a/resources/views/settings/roles/edit.blade.php b/resources/views/settings/roles/edit.blade.php
index f98e6e0b3..7e186e898 100644
--- a/resources/views/settings/roles/edit.blade.php
+++ b/resources/views/settings/roles/edit.blade.php
@@ -11,11 +11,11 @@
             </div>
             <div class="col-sm-6">
                 <p></p>
-                <a href="/settings/roles/delete/{{ $role->id }}" class="button neg float right">Delete Role</a>
+                <a href="{{ baseUrl("/settings/roles/delete/{$role->id}") }}" class="button neg float right">Delete Role</a>
             </div>
         </div>
 
-        <form action="/settings/roles/{{ $role->id }}" method="POST">
+        <form action="{{ baseUrl("/settings/roles/{$role->id}") }}" method="POST">
             <input type="hidden" name="_method" value="PUT">
             @include('settings/roles/form', ['model' => $role])
         </form>
diff --git a/resources/views/settings/roles/form.blade.php b/resources/views/settings/roles/form.blade.php
index 6181acaea..5e653f8de 100644
--- a/resources/views/settings/roles/form.blade.php
+++ b/resources/views/settings/roles/form.blade.php
@@ -109,7 +109,7 @@
                 </table>
             </div>
         </div>
-        <a href="/settings/roles" class="button muted">Cancel</a>
+        <a href="{{ baseUrl("/settings/roles") }}" class="button muted">Cancel</a>
         <button type="submit" class="button pos">Save Role</button>
     </div>
     <div class="col-md-3">
@@ -119,10 +119,10 @@
         <table class="list-table">
             @foreach($role->users as $user)
                 <tr>
-                    <td style="line-height: 0;"><img class="avatar small" src="{{$user->getAvatar(40)}}" alt="{{$user->name}}"></td>
+                    <td style="line-height: 0;"><img class="avatar small" src="{{ $user->getAvatar(40) }}" alt="{{ $user->name }}"></td>
                     <td>
                         @if(userCan('users-manage') || $currentUser->id == $user->id)
-                            <a href="/settings/users/{{$user->id}}">
+                            <a href="{{ baseUrl("/settings/users/{$user->id}") }}">
                                 @endif
                                 {{ $user->name }}
                                 @if(userCan('users-manage') || $currentUser->id == $user->id)
diff --git a/resources/views/settings/roles/index.blade.php b/resources/views/settings/roles/index.blade.php
index 358c24945..2c905ae22 100644
--- a/resources/views/settings/roles/index.blade.php
+++ b/resources/views/settings/roles/index.blade.php
@@ -12,7 +12,7 @@
             </div>
             <div class="col-sm-4">
                 <p></p>
-                <a href="/settings/roles/new" class="button float right pos"><i class="zmdi zmdi-lock-open"></i>Add new role</a>
+                <a href="{{ baseUrl("/settings/roles/new") }}" class="button float right pos"><i class="zmdi zmdi-lock-open"></i>Add new role</a>
             </div>
         </div>
 
@@ -24,7 +24,7 @@
             </tr>
             @foreach($roles as $role)
                 <tr>
-                    <td><a href="/settings/roles/{{ $role->id }}">{{ $role->display_name }}</a></td>
+                    <td><a href="{{ baseUrl("/settings/roles/{$role->id}") }}">{{ $role->display_name }}</a></td>
                     <td>{{ $role->description }}</td>
                     <td class="text-right">{{ $role->users->count() }}</td>
                 </tr>
diff --git a/resources/views/users/create.blade.php b/resources/views/users/create.blade.php
index 716742ba8..b25f2ee8a 100644
--- a/resources/views/users/create.blade.php
+++ b/resources/views/users/create.blade.php
@@ -6,9 +6,9 @@
     <div class="container small" ng-non-bindable>
         <h1>Create User</h1>
 
-        <form action="/settings/users/create" method="post">
+        <form action="{{ baseUrl("/settings/users/create") }}" method="post">
             {!! csrf_field() !!}
-            @include('users.forms.' . $authMethod)
+            @include('users/forms/' . $authMethod)
         </form>
     </div>
 
diff --git a/resources/views/users/delete.blade.php b/resources/views/users/delete.blade.php
index af247509d..74b993b3c 100644
--- a/resources/views/users/delete.blade.php
+++ b/resources/views/users/delete.blade.php
@@ -4,13 +4,13 @@
 
     <div class="container small" ng-non-bindable>
         <h1>Delete User</h1>
-        <p>This will fully delete this user with the name '<span class="text-neg">{{$user->name}}</span>' from the system.</p>
+        <p>This will fully delete this user with the name '<span class="text-neg">{{ $user->name }}</span>' from the system.</p>
         <p class="text-neg">Are you sure you want to delete this user?</p>
 
-        <form action="/settings/users/{{$user->id}}" method="POST">
+        <form action="{{ baseUrl("/settings/users/{$user->id}") }}" method="POST">
             {!! csrf_field() !!}
             <input type="hidden" name="_method" value="DELETE">
-            <a href="/settings/users/{{$user->id}}" class="button muted">Cancel</a>
+            <a href="{{ baseUrl("/settings/users/{$user->id}") }}" class="button muted">Cancel</a>
             <button type="submit" class="button neg">Confirm</button>
         </form>
     </div>
diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php
index 16fc1bfa2..d06ec09bc 100644
--- a/resources/views/users/edit.blade.php
+++ b/resources/views/users/edit.blade.php
@@ -8,14 +8,14 @@
 
 
     <div class="container small">
-        <form action="/settings/users/{{$user->id}}" method="post">
+        <form action="{{ baseUrl("/settings/users/{$user->id}") }}" method="post">
             <div class="row">
                 <div class="col-sm-8">
                     <h1>Edit {{ $user->id === $currentUser->id ? 'Profile' : 'User' }}</h1>
                 </div>
                 <div class="col-sm-4">
                     <p></p>
-                    <a href="/settings/users/{{$user->id}}/delete" class="neg button float right">Delete User</a>
+                    <a href="{{ baseUrl("/settings/users/{$user->id}/delete") }}" class="neg button float right">Delete User</a>
                 </div>
             </div>
             <div class="row">
@@ -29,7 +29,7 @@
                 <div class="form-group" id="logo-control">
                     <label for="user-avatar">User Avatar</label>
                     <p class="small">This image should be approx 256px square.</p>
-                    <image-picker resize-height="512" resize-width="512" current-image="{{ $user->getAvatar(80) }}" current-id="{{ $user->image_id }}" default-image="/user_avatar.png" name="image_id" show-remove="false" image-class="['avatar' ,'large']"></image-picker>
+                    <image-picker resize-height="512" resize-width="512" current-image="{{ $user->getAvatar(80) }}" current-id="{{ $user->image_id }}" default-image="{{ baseUrl("/user_avatar.png") }}" name="image_id" show-remove="false" image-class="['avatar' ,'large']"></image-picker>
                 </div>
             </div>
         </div>
@@ -49,9 +49,9 @@
                         <div><i class="zmdi zmdi-google-plus-box zmdi-hc-4x" style="color: #DC4E41;"></i></div>
                         <div>
                             @if($user->hasSocialAccount('google'))
-                                <a href="/login/service/google/detach" class="button neg">Disconnect Account</a>
+                                <a href="{{ baseUrl("/login/service/google/detach") }}" class="button neg">Disconnect Account</a>
                             @else
-                                <a href="/login/service/google" class="button pos">Attach Account</a>
+                                <a href="{{ baseUrl("/login/service/google") }}" class="button pos">Attach Account</a>
                             @endif
                         </div>
                     </div>
@@ -61,9 +61,9 @@
                         <div><i class="zmdi zmdi-github zmdi-hc-4x" style="color: #444;"></i></div>
                         <div>
                             @if($user->hasSocialAccount('github'))
-                                <a href="/login/service/github/detach" class="button neg">Disconnect Account</a>
+                                <a href="{{ baseUrl("/login/service/github/detach") }}" class="button neg">Disconnect Account</a>
                             @else
-                                <a href="/login/service/github" class="button pos">Attach Account</a>
+                                <a href="{{ baseUrl("/login/service/github") }}" class="button pos">Attach Account</a>
                             @endif
                         </div>
                     </div>
diff --git a/resources/views/users/forms/ldap.blade.php b/resources/views/users/forms/ldap.blade.php
index 5fc8ce397..6e4d2a5fd 100644
--- a/resources/views/users/forms/ldap.blade.php
+++ b/resources/views/users/forms/ldap.blade.php
@@ -25,6 +25,6 @@
 @endif
 
 <div class="form-group">
-    <a href="/settings/users" class="button muted">Cancel</a>
+    <a href="{{ baseUrl("/settings/users") }}" class="button muted">Cancel</a>
     <button class="button pos" type="submit">Save</button>
 </div>
\ No newline at end of file
diff --git a/resources/views/users/forms/standard.blade.php b/resources/views/users/forms/standard.blade.php
index 52ebac976..d902c5b2c 100644
--- a/resources/views/users/forms/standard.blade.php
+++ b/resources/views/users/forms/standard.blade.php
@@ -34,7 +34,7 @@
 </div>
 
 <div class="form-group">
-    <a href="/settings/users" class="button muted">Cancel</a>
+    <a href="{{ baseUrl("/settings/users") }}" class="button muted">Cancel</a>
     <button class="button pos" type="submit">Save</button>
 </div>
 
diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php
index d539f314e..e72a9e61a 100644
--- a/resources/views/users/index.blade.php
+++ b/resources/views/users/index.blade.php
@@ -14,7 +14,7 @@
             <div class="col-sm-4">
                 <p></p>
                 @if(userCan('users-manage'))
-                    <a href="/settings/users/create" class="pos button float right"><i class="zmdi zmdi-account-add"></i>Add new user</a>
+                    <a href="{{ baseUrl("/settings/users/create") }}" class="pos button float right"><i class="zmdi zmdi-account-add"></i>Add new user</a>
                 @endif
             </div>
         </div>
@@ -26,9 +26,9 @@
                 </div>
             </div>
             <div class="col-sm-4">
-                <form method="get" class="float right" action="/settings/users">
+                <form method="get" class="float right" action="{{ baseUrl("/settings/users") }}">
                     @foreach(collect($listDetails)->except('search') as $name => $val)
-                        <input type="hidden" name="{{$name}}" value="{{$val}}">
+                        <input type="hidden" name="{{ $name }}" value="{{ $val }}">
                     @endforeach
                     <input type="text" name="search" placeholder="Search Users" @if($listDetails['search']) value="{{$listDetails['search']}}" @endif>
                 </form>
@@ -47,10 +47,10 @@
             </tr>
             @foreach($users as $user)
                 <tr>
-                    <td style="line-height: 0;"><img class="avatar med" src="{{$user->getAvatar(40)}}" alt="{{$user->name}}"></td>
+                    <td style="line-height: 0;"><img class="avatar med" src="{{ $user->getAvatar(40)}}" alt="{{ $user->name }}"></td>
                     <td>
                         @if(userCan('users-manage') || $currentUser->id == $user->id)
-                            <a href="/settings/users/{{$user->id}}">
+                            <a href="{{ baseUrl("/settings/users/{$user->id}") }}">
                                 @endif
                                 {{ $user->name }}
                                 @if(userCan('users-manage') || $currentUser->id == $user->id)
@@ -59,7 +59,7 @@
                     </td>
                     <td>
                         @if(userCan('users-manage') || $currentUser->id == $user->id)
-                            <a href="/settings/users/{{$user->id}}">
+                            <a href="{{ baseUrl("/settings/users/{$user->id}") }}">
                                 @endif
                                 {{ $user->email }}
                                 @if(userCan('users-manage') || $currentUser->id == $user->id)
@@ -68,7 +68,7 @@
                     </td>
                     <td>
                         @foreach($user->roles as $index => $role)
-                            <small><a href="/settings/roles/{{$role->id}}">{{$role->display_name}}</a>@if($index !== count($user->roles) -1),@endif</small>
+                            <small><a href="{{ baseUrl("/settings/roles/{$role->id}") }}">{{$role->display_name}}</a>@if($index !== count($user->roles) -1),@endif</small>
                         @endforeach
                     </td>
                 </tr>
diff --git a/resources/views/users/profile.blade.php b/resources/views/users/profile.blade.php
index 10189f9aa..1ae869979 100644
--- a/resources/views/users/profile.blade.php
+++ b/resources/views/users/profile.blade.php
@@ -12,7 +12,7 @@
                     <div class="col-md-7">
                         <div class="clearfix">
                             <div class="padded-right float left">
-                                <img class="avatar square huge" src="{{$user->getAvatar(120)}}" alt="{{ $user->name }}">
+                                <img class="avatar square huge" src="{{ $user->getAvatar(120) }}" alt="{{ $user->name }}">
                             </div>
                             <div>
                                 <h3 style="margin-top: 0;">{{ $user->name }}</h3>