Htaccess does not work on hosting server

Asked

Viewed 214 times

0

Rewrite mode in htaccess only works on local server when put it to me hosting provider does not work properly,

I have this core class

class Core {

    public function run() {

        $url = explode("index.php", $_SERVER['PHP_SELF']);
        $url = end($url);
        echo $url;
        $param = array();
        if (!empty($url)) {

            $url = explode('/', $url);
            array_shift($url);

            $controller = $url[0] . 'Controller';
            array_shift($url);

            if (isset($url[0])) {
                $action = $url[0];
                array_shift($url);
            } else {
                $action = "index";
            }

            if (count($url) > 0) {
                $param = $url;
            }
        } else {
            $controller = "indexController";
            $action = "index";
        }
        $c = new $controller();
        call_user_func_array(array($c, $action), $param);
    }
}

That’s the htaccess

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

The idea is to make the url work like this, www.endereço.com.br/post/ver/development, but it only works like this, www.endereço.com.br/index.php/post/ver/development, I wanted to take this index.php but it doesn’t work, only in place, I use the hostgator server with Cpanel, someone has some hint that may be

  • There is no other file or other rule in the same file that might be conflicting?

  • I have an Inde.php file that only calls the core method <?php require './Config.inc.php'; $core = new Core(); $core->run(); ;?>

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.