I am having issues redirecting to index.php in my slim app with .htaccess file. Routes work if I add the index.php at the end of the URL
So slimapp.dev/hello/myname
gets error
Not Found The requested URL /hello/myname was not found on this server.
while slimapp.dev/index.php/hello/myname
works
Here is my .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index.php [QSA,L]
I am using Apache 2 on Ubuntu 18.04
File structure
public_html
|_index.php
|_ vendor
|_.htaccess
virtualHost 000-default.conf
<VirtualHost *:80>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
If I use the php -S localhost:3000
it works as expected but if I use the Apache web server, I most add the index.php to the end of the URL to make it work. Thanks