M
M
mihass2018-09-13 11:37:24
htaccess
mihass, 2018-09-13 11:37:24

Need help setting up a redirect via htaccess, can you help :)?

There are urls on the site that end with site.html and there are also urls that end with site/
It is necessary to make it so that in the case of a request site.html/ (with a slash at the end) it redirects to the url without the slash site.tml
But at the same time, the action rules should not apply to url like site
/ only urls that end in html should be redirected to without a slash. I
added such rules, the redirect works, but for all urls without exceptions.

RewriteCond %{request_method} ^GET$
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, 2018-09-13
@mihass

RewriteRule ^(.+\.html)/$ /$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