My .htaccess file looks like this:
Options -Multiviews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php
The problem I am facing is that when I try to access my site without www. the prefix, the .php extension is added to the address, which can often cause a problem. For example, if I try to access my homepage with the address example.com, this address will be converted to www.example.com/.php. I want www. to add, but the .php extension added at the end causes an error. How to fix it?
source
share