L
L
LMI2016-09-24 11:36:31
HTML
LMI, 2016-09-24 11:36:31

.htaccess: How to remove the .html extension and add a slash at the end?

There is a static site. Remove the .html extension from links. I successfully did this, BUT!

RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://site.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html

It worked like this - site.com/category-name/page.html
Now it works like this - site.com/category-name/page
NOW I need to add a slash at the end of the page name to make it like this - site.com/category-name/page /, BUT the path does not lead to a file, but looks for a .html file in the page folder, which does not exist.
How to add a slash to .htaccess so that the slash is added to the page, and not looking for a file in a folder?

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