I have such a .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteRule cache/ - [F]
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-zA-Z0-9\-\_\/]*)$ index.php?p=$1
# Blokada hotlinking czyli kradzieży obrazków
RewriteCond %{HTTP_REFERER} !^https://(.+\.)?nazwadomeny.pl/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
# Prevent viewing of htaccess file.
<Files .htaccess>
order allow,deny
deny from all
</Files>
RedirectMatch 403 ^.*/apps/(.*).php(.*)$
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl|map)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
Links on the site look like this:
http: // localhost / admin / SystemConfiguration / RemoveFile
http: // localhost / admin / SystemConfiguration / addFile
http: // localhost / admin / SystemConfiguration
I would like to extend this by adding the next slash with the parameter:
http: // localhost / admin / UserList / User / IDUsera
http: // localhost / admin / UserList / User / IDUsera / Category
Or if it can not be done, at least for the script to “catch” values from $ _GET:
http: // localhost / admin / UserList / User? id = IDUser
a
Although I would prefer this one solution.
The dispatcher of my application looks like this:
public function dispatch()
{
$this->request = new Request();
Router::parse($this->request->url, $this->request);
$controller = $this->loadController();
call_user_func_array([$controller, $this->request->action], $this->request->params);
}
public function loadController()
{
$config = \Core\Utilities\Registry::register("Core\Utilities\Config");
if (ADMIN_MODE === true) {
$file = $config->backend_controller_path . '' . $this->request->controller . '.php';
$controllerName = 'Backend\Controllers\\' . $this->request->controller . "AdminController";
} else {
$file = $config->frontend_controller_path . '' . $this->request->controller . '.php';
$controllerName = 'Frontend\Controllers\\' . $this->request->controller . "Controller";
}
if (file_exists("../" . $file)) {
require_once("../" . $file);
$controller = new $controllerName();
return $controller;
} else {
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . SERVER_ADDRESS);
exit();
}
}
}
class Request
{
public $url;
public function __construct()
{
$this->url = str_replace("p=", "", $_SERVER['QUERY_STRING']);
}
}
s it possible to introduce such a change without modifying php (in .htacces itself)? It can be seen as another parameter or something …
This site works, I wanted to add only one function without breaking the rest of the code