.htaccess 文件中的条件重定向用于双 .html

Conditional redirect in .htaccess file for double .html

我正在尝试在 htaccess 文件中为双 .html URL 添加条件。

请看下面url:

http://example.com/test-page.html.html

它应该重定向到下面 url:

http://example.com/test-page.html

请帮忙!!!

您可以在 htaccess 文件中使用以下重定向

RedirectMatch 301 ^/(.+)\.html\.html$ /.html

这会将 /file.html.html 重定向到 /file.html .