S
S
sexolog2021-02-18 18:47:18
PHP
sexolog, 2021-02-18 18:47:18

How to make 301 redirect from .html to php via .htaccess?

In a WordPress blog, all entries (1000+ items) with .html at the end of the URL (for example, test.ru/blog/page.html)

Now you need to make a transition to the PHP page (for example, test.ru/blog/page). This is solved by setting in the admin panel.

But after that, all pages in search engines will return 404. How to make a correct redirect on the entire site so that 301 redirects from .html to without work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2021-02-18
@SagePtr

What if you do it stupidly?

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question