URL rewrite module
This commit is contained in:
parent
dd85dee382
commit
69e1de657e
|
@ -1,8 +1,5 @@
|
||||||
AddDefaultCharset UTF-8
|
AddDefaultCharset UTF-8
|
||||||
|
|
||||||
# Remove the trailing slash from URL
|
|
||||||
DirectorySlash Off
|
|
||||||
|
|
||||||
# Enable rewrite rules
|
# Enable rewrite rules
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
@ -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
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Url
|
||||||
|
|
||||||
$this->notFound = false;
|
$this->notFound = false;
|
||||||
|
|
||||||
$this->slug = false;
|
$this->slug = '';
|
||||||
|
|
||||||
$this->filters = array();
|
$this->filters = array();
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,16 @@ class Url
|
||||||
|
|
||||||
foreach($filters as $filterKey=>$filter)
|
foreach($filters as $filterKey=>$filter)
|
||||||
{
|
{
|
||||||
|
// getSlugAfterFilter() set the variable $this->slug
|
||||||
$slug = $this->getSlugAfterFilter($filter);
|
$slug = $this->getSlugAfterFilter($filter);
|
||||||
|
|
||||||
|
// If the filter is included in the URI.
|
||||||
if($slug!==false)
|
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(empty($slug))
|
||||||
{
|
{
|
||||||
if($filter==='/')
|
if($filter==='/')
|
||||||
|
@ -63,10 +70,15 @@ class Url
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($filter===$adminFilter['admin'])
|
||||||
|
{
|
||||||
|
$this->whereAmI = 'admin';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$this->setNotFound(true);
|
$this->setNotFound(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->whereAmI = $filterKey;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,8 +149,8 @@ class Url
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the slug after the $filter
|
// Return the slug after the $filter
|
||||||
// If the filter is not contain in the uri, returns FALSE
|
// If the filter is not included 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 included in the uri and the slug is not empty, returns the slug
|
||||||
// ex: http://domain.com/cms/$filter/slug123 => slug123
|
// ex: http://domain.com/cms/$filter/slug123 => slug123
|
||||||
private function getSlugAfterFilter($filter)
|
private function getSlugAfterFilter($filter)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue