I have a site that contains URL https://app.bitlabtech.com/ for normal users and for admin users https://app.bitlabtech.com/manager/
After the client login to the site, it redirects to https://app.bitlabtech.com/?page=home and when they request another page like send mail then the URL looks like https://app.bitlabtech.com/?page=sendEmail. I want to rewrite the URL to https://app.bitlabtech.com/home instead of https://app.bitlabtech.com/?page=home and https://app.bitlabtech.com/sendEmail instead of https://app.bitlabtech.com/?page=sendEmail.
Code running on UBUNTU 20.04 apache server.
For better understanding, I have attached my PHP code here
public static $page = "page";
public static $folder = PAGES_DIR;
public static function getParam($param = null){
if(!empty($param)) {
return isset($_GET[$param]) && $_GET[$param] != "" ? $_GET[$param] : null;
}
}
public static function cPage(){
return isset($_GET[self::$page]) ? $_GET[self::$page] : "index";
}
public static function getPage(){
$page = self::$folder.DS.self::cPage().".php";
$error = self::$folder.DS."error.php";
return is_file($page) ? $page : $error;
}
public static function getReferrerUrl() {
$page = self::getParam(Login::$_referrer);
return !empty($page) ? "/?page={$page}" : null;
}
}
?>```
assuming index.php is index file the following code will allow apache to catch pretty url and call the right php
RewriteEngine On
# any word without slash
RewriteRule ^([^/]*)$ index.php?page=$1 [L]
But you need to change your code to use these pretty urls