C
C
CapitanFreeloader2016-09-22 18:58:38
Apache HTTP Server
CapitanFreeloader, 2016-09-22 18:58:38

Why can't a slash be added at the end of the url?

I can't figure out why the following code doesn't work:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^.*$ $0.php [L,QSA]
RewriteCond %{THE_REQUEST} ([^\s]*)\.php(\?[^\s]*)?
RewriteRule (.*) %1 [R=301,L]

RewriteBase /
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [L,R=301]

It should:
1) discard the php extension
2) redirect from .php to non-php 3
) add / at the end

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question