Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

129
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda