Index.php routing not working

Hi there, I’ve been trying to access routing using my index.php, but only one route (to “/”) works.
My site address:

How my index.php looks like:

What happens after I try to access

How my folder structure looks like:

How my Router class looks like:

I can’t figure out why the code in the Router class is not executed the way I expect it to.
On my local server, everything works fine.

Any ideas?

Hi! You may need to redirect all incoming requests to index.php.

Add the following rules to .htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L,QSA]

You may want to check out this answer: .htaccess - Redirect all to index.php using htaccess - Stack Overflow.

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.