friendly urls for various folders [closed]

1

I have these urls, I'm using subfolders, but htaccess will stay in the root

MEDICAL PASTA

When the person logs in for redirection it appears in the url? id = 1 without the index

laudar.php?id=1
relatoriolaudos.php?id=1
listalaudos.php?id=1
imprimir.php?id=1&idlaudo=1
editarlaudo.php?id=1&idlaudo=1
bloqueado.php?id=1&idlaudo=1&idusuario=1&nivelu=1&status=1
editardados.php?id=1

PASSWORD LOGIN

index.php
senhaincorreta.php
sair.php
mensagem.php

ADMINISTRATOR FOLDER

When the person logs in for redirection it appears in the url? id = 1 without the index

cadastrodemedicos.php?id=1
cadastrodedigitador.php?id=1
cadastroCategoria.php?id=1
cadastrodeexames.php?id=1
cadastrodeadministrador.php?id=1
cadastrodeadministrador.php?id=1



pesquisademedicos.php?id=1
pesquisadedigitador.php?id=1
pesquisaCategoria.php?id=1
pesquisadeexames.php?id=1
pesquisadeadministrador.php?id=1

exibeadmin.php?id=1&idadmin=1
exibemedico.php?id=1&idmedico=1
exibedigitador.php?id=1&iddigitador=1
pesquisaCategoria.php?id=1
exibetipo.php?id=1&idtipo=5


editaradmin.php?id=1&idadmin=1
editarmedico.php?id=1&idmedico=1
editardigitador.php?id=1&iddigitador=1
editarcategoria.php?id=1&idcategoria=2

DIGITAL FOLDER

When the person logs in to redirection it appears in url ?id=1 without the index

digitando.php?id=2
digitar.php?id=2&idlaudo=4
revisao.php?id=2
imprimir.php?id=2&idlaudo=1
    
asked by anonymous 08.08.2015 / 21:14

1 answer

0

You can work your htaccess like this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Afterwards, you can also use $_SERVER['REQUEST_URI'] to fetch your URL, based on that, to work the internal ones one by one ...

And you should pass idUsuario to session so that it can not be exchanged via URL .

This would be a practical example:

// Recupera a URL da requisição e seus parâmetros, separando em um vetor dividido pelo caracter "/"
$geturl = explode( "/", str_replace( strrchr( $_SERVER["REQUEST_URI"], "?" ), "", $_SERVER["REQUEST_URI"] ) );
array_shift( $geturl );

// Considera o primeiro parâmetro como o arquivo php
$tipo = $geturl[0];

// Se o arquivo existir, inclui na página. Caso contrário, devemos redirecionar o usuário para uma
// tela amigável de error 404
if ( is_file( "$tipo.php" ) )
{
    include "$tipo.php";
}
else
{
    echo "Página não encontrada";   
}

Another option is to take a look at this article: link

    
08.08.2015 / 22:58