There is something I'm missing here : Remove .php extension with .htaccess
My goal:
Redirect everything from www to non-www
Current code in .htaccess
RewriteEngine on
Options -Indexes
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ /$1.php [L]
Current behaviour:
Redirects everything from www to non-www but adds the php file extension ".php" in URIs (the php files do exists)
E.g:
www.example.com/hello
redirects to
example.com/hello.php
What should I do to avoid the php extension in the URI ?