I have this htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
Therefore, my .php files can be called without the .php extension.
But I would like to be called only with the final slash. Therefore, when this trailing slash is not specified, it must be added with 301. The problem is that this creates problems with the initial www and the internal .php extension (sometimes this adds the .php recursively).
How can I do that?
Thank!
source
share