Friendly URL redirects to index.php

0

I'm having trouble directing my friendly url to the specific pages. When I click on authorized resellers for example, it is taking me to index.php

I have the vars.php code

 <?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;
}

?>

No

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>

Within each page I am calling

<?php require('vars.php'); ?>
    
asked by anonymous 04.10.2016 / 17:23

1 answer

1

You do not even have to, just use .htaccess like this:

<IfModule mod_rewrite.c>
RewriteEngine On
    #URL's Amigáveis - friendly urls
    RewriteRule ^index/?$ index.php [NC,L]
</IfModule>
    
04.10.2016 / 17:47