On local host I was running my php (MVC) application with following rules in my .htaccess file:
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(config|core|css|js|fonts|images|robots\.txt)
RewriteRule ^(.+)$ index.php/$1 [L]
E.g. localhost/myapp/register/login will load the log in page.
But on a live server I'm having issues. The first problem I've faced was No input file specified. Reading this answer I changed this line RewriteRule ^(.+)$ index.php/$1 [L] to RewriteRule ^(.*)$ index.php?/$1 [L]. This solved the first problem but created another problem and now it's always loading the same/default view and controller no matter what the url is.
In my index.php has the following lines of code:
$url = isset($_SERVER['PATH_INFO']) ? explode('/', ltrim($_SERVER['PATH_INFO'], '/')) : [];
// Route the request
Router::route($url);
So, I checked the $_SERVER['PATH_INFO'] value and it's empty. Now my question is why it's empty and how can i achieve the normal behavior of the urls.