0
I’m having trouble directing my friendly url to specific pages. When I click on authorized-resellers for example, it’s taking me to index.php
I have the code vars.php
<?php
//var_dump($_SERVER);
function parse_path() {
$path = array();
if (isset($_SERVER['REQUEST_URI'])) {
$request_path = explode('?', $_SERVER['REQUEST_URI']);
$path['base'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/');
$path['call_utf8'] = substr(urldecode($request_path[0]), strlen($path['base']) + 1);
$path['call'] = utf8_decode($path['call_utf8']);
if ($path['call'] == basename($_SERVER['PHP_SELF'])) {
$path['call'] = '';
}
$path['call_parts'] = explode('/', $path['call']);
$path['query_utf8'] = urldecode($request_path[1]);
$path['query'] = utf8_decode(urldecode($request_path[1]));
$vars = explode('&', $path['query']);
foreach ($vars as $var) {
$t = explode('=', $var);
$path['query_vars'][$t[0]] = $t[1];
}
}
return $path;
}
?>
<?php
switch($path_info['call_parts'][0]) {
case 'aunimed': include 'aunimed.php';
break;
case 'revendas-autorizadas': include 'revendas-autorizadas.php';
break;
}
?>
Not
And I have in my . htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>
Inside every page I’m calling
<?php require('vars.php'); ?>
When you say "friendly url" is removing ". php" from url?
– Miguel
Exactly @Miguel
– Marcelo Victor