I’m attempting to clean some urls in a simple PHP application I have deployed on google cloud servers (Ubuntu). However, the redirect conditions I have written in a .htaccess file seemed to be ignored. I’ve went through Google’s documentation and I haven’t found a solution, I’ve gone through my .config files and ensured that mods_rewrite was enabled. I was thinking that because i’m on a shared server that the rules are being ignored. IF anyone has any suggestions or workarounds, please suggest.
Here is the .htaccess file for reference:
Options +MultiViews
#Remove php extension
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
#Remove html extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
2
Answers
I spent a few hours playing with the .config files, if you edit the virtual host settings in 000-default.conf in the /etc/apache2/sites-available/ folder . I removed the Options Followsyslinks line. I don't know how this will effect security or performance, so I'll read up on that.
*Note that this for apache version 2.4.18
at google cloud service you can install apache2 and enbale .htaccess on it :’)
and search this line :
change to :