Apache Rewrite Rule to remove .php Extension adds multiple slashes

67 views Asked by At

In my httpd.conf from Apache I have following code:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{THE_REQUEST} ^GET\s.+\.php [NC]
RewriteRule ^(.+)\.php$ /$1 [NE,R=301,L,NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.*?)/?$ $1.php [L]

This URL: http://localhost/news.php Becomes this URL: http://localhost//news

I want to remove the double slash after localhost (http://localhost/news). I tried many Code Snippets from other questions to remove them, but nothing worked.

0

There are 0 answers