Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda