From 69e1de657ea36e7477716388ac9cd68201b749e6 Mon Sep 17 00:00:00 2001 From: dignajar Date: Tue, 23 Jun 2015 01:20:19 -0300 Subject: [PATCH] URL rewrite module --- .htaccess | 3 --- admin/index.php | 5 +++++ content/readme | 5 ++++- kernel/url.class.php | 20 ++++++++++++++++---- 4 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 admin/index.php diff --git a/.htaccess b/.htaccess index caea0515..850d902a 100644 --- a/.htaccess +++ b/.htaccess @@ -1,8 +1,5 @@ AddDefaultCharset UTF-8 -# Remove the trailing slash from URL -DirectorySlash Off - # Enable rewrite rules RewriteEngine on diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 00000000..fa3b06ae --- /dev/null +++ b/admin/index.php @@ -0,0 +1,5 @@ +Error, enable rewrite module. + +Documentation: +- http://docs.bludit.com/en/getting-started/requirements +- http://docs.bludit.com/en/troubleshooting/browser-returns-not-found \ No newline at end of file diff --git a/content/readme b/content/readme index c1f2c23e..367c969e 100644 --- a/content/readme +++ b/content/readme @@ -1 +1,4 @@ -Set the right permissions on this directory. Check the documentation. +Set the right permissions for this directory. + +Documentation: +- http://docs.bludit.com/en/troubleshooting/writing-test-failure-err205 diff --git a/kernel/url.class.php b/kernel/url.class.php index 38982cbd..8ac9e6d9 100644 --- a/kernel/url.class.php +++ b/kernel/url.class.php @@ -28,7 +28,7 @@ class Url $this->notFound = false; - $this->slug = false; + $this->slug = ''; $this->filters = array(); } @@ -52,9 +52,16 @@ class Url foreach($filters as $filterKey=>$filter) { + // getSlugAfterFilter() set the variable $this->slug $slug = $this->getSlugAfterFilter($filter); + + // If the filter is included in the URI. if($slug!==false) { + // Where Am I is the filter now, because is in the URI. + $this->whereAmI = $filterKey; + + // If the slug empty if(empty($slug)) { if($filter==='/') @@ -63,10 +70,15 @@ class Url break; } + if($filter===$adminFilter['admin']) + { + $this->whereAmI = 'admin'; + break; + } + $this->setNotFound(true); } - $this->whereAmI = $filterKey; break; } } @@ -137,8 +149,8 @@ class Url } // Return the slug after the $filter - // If the filter is not contain in the uri, returns FALSE - // If the filter is contain in the uri and the slug is not empty, returns the slug + // If the filter is not included in the uri, returns FALSE + // If the filter is included in the uri and the slug is not empty, returns the slug // ex: http://domain.com/cms/$filter/slug123 => slug123 private function getSlugAfterFilter($filter) {