How do I create Mod_Rewrite (htaccess)
rules for my pages? I'm not used to .htaccess
Rules you would like to:
www.exemplo.com/index.php
to www.exemplo.com
www.exemplo.com/perfil.php
to www.exemplo.com/perfil
www.exemplo.com/perfil.php?p=fulano-da-silva
to www.exemplo.com/perfil/fulano-da-silva
www.exemplo.com/video.php?p=fulano-da-silva&m=nome-do-video
to www.exempli.com/perfil/fulano-da-silva/nome-do-video
Code:
.htaccess
RewriteEngine On
RewriteRule %{REQUEST_FILENAME} !-f
RewriteRule %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?pag=$1
url.php
<?php
$atual = (isset($_GET['isw'])) ? $_GET['isw'] : 'home';
$pasta = 'paginas';
if (substr_count($atual, '/') > 0) {
$atual = explode('/', $atual);
$pagina = (file_exists("{$pasta}/" . $atual[0] . '.php')) ? $atual[0] : 'erro';
$id = $atual[1];
$busca = @$atual[2];
} else {
$pagina = (file_exists("{$pasta}/" . $atual . '.php')) ? $atual : 'erro';
$id = 0;
$frame=0;
}?>
index.php
<?php require_once('url.php') ?>
<?php include $pasta.'/'.$pagina.'.php'; ?>
Could someone give a light?