K
K
konanov2021-10-08 16:43:44
htaccess
konanov, 2021-10-08 16:43:44

How to write a 301 redirect from site.ru/blog.html to site.ru/blog?

The situation is relevant for all urls on the site.

Thanks a lot!

I found such an option, but as far as I understand it just makes a redirect, but it needs 301 ....

RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L ,R]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]

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