I've just finished setting up my first app on localhost - and the .htaccess working incredibly fine. I just uploaded the files to Google Cloud LAMP Server, set up the database & got everything working -- however, for some reason the PHP files are not being located (?) which is strange because it's working in localhost just fine, and HTML files seem to be rewrited just fine as well! Here's the error log in apache:
Negotiation: discovered file(s) matching request: /var/www/html/index (None could be negotiated).
Here's my .htaccess
:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
What is strange is that it's rewriting HTML with no problem but PHP files will throw this:
Not Found
The requested URL was not found on this server.
I tried pretty much everything:
- Changed /etc/apache2/apache2.conf
- Changed /etc/apache2/sites-available/000-default.conf
- Made sure that 'a2enmod rewrite' is enabled
Still, getting
Not Found
The requested URL was not found on this server.