Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Rewrite the URL based on page name

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;
    }   
}

?>```
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!