0
Good afternoon guys, I’m having a problem in my . htacess, I’m doing a test by xampp, only it returns me page not found or similar, I’ve done N form and nothing, man . htacess it takes the end of . php and adds do not know the problem is my index.php, I will send the codes.
.htacess
RewriteEngine On
RewriteBase /
# Remover extensão do arquivo (exemplo: /arquivo.php para /arquivo)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1/ [R,L]
# Adicionar o barra (/) no final do endereço URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteRule . %{REQUEST_URI}/ [L,R=301]
# Redirecionar internamente as páginas sem extensão para o arquivo correspondente (crucial para o funcionamento da página)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
index php.
<?php
$url = (isset($_GET['url'])) ? $_GET['url']:'home';
$url = array_filter(explode('/',$url));
$file = $url[0].'.php';
if(is_file($file)){
include $file;
}else{
include '404.php';
}
?>
Hello, explain better what you’re trying to do, please. If I understand correctly, you want to forward all requests to the 'index.php' page. That’s right?
– Marcos Alexandre
the problem is that I don’t know if I did this part of the index.php , what I want is ex: http://meusite.com.br (home) quemsomos.php -> /quemsomos contato.php -> /contato
– Fabio Silva