Skip to content

Instantly share code, notes, and snippets.

@digitalbocca
Created June 14, 2017 17:07
Show Gist options
  • Save digitalbocca/30eb3d66b96dcd8e1021f8e9b1467de2 to your computer and use it in GitHub Desktop.
Save digitalbocca/30eb3d66b96dcd8e1021f8e9b1467de2 to your computer and use it in GitHub Desktop.
Snnipets de Código para SuaAmigaURL (https://github.com/digitalbocca/SuaAmigaURL)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#URL AMIGAVEL PASSANDO UM SLUG PARA A INDEX
RewriteRule ^([a-z0-9-]+)/?$ index.php?slug=$1 [NC]
</IfModule>
//CRIA UM OBJETO URLAmigavel
$url = new URLAmigavel($_GET['slug']);
//CRIA UM OBJETO URLAmigavel
$url = new URLAmigavel($_SERVER['REQUEST_URI']);
if(isset($_SERVER['REQUEST_URI'])){
    //Código que faz alguma coisa.
}
//REMOVENDO UM NÍVEL DA URI
$removeNivel = new RemovedorDeNivel($url,3);
$_SERVER['REQUEST_URI'];
$_GET['slug'];
if(isset($_GET['slug'])){
    //Código que faz alguma coisa.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment