P
P
photosho2021-12-24 12:30:56
htaccess
photosho, 2021-12-24 12:30:56

How to redirect all addresses except those with "html" at the end?

There is a regular expression that redirects from pages without a slash to pages with a slash. Please help change it so that all pages except those with ".html" at the end are redirected.

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-12-24
@photosho

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question