标签: php .htaccess redirect seo http-status-code-301
我在.htaccess文件中创建了301个RedirectMatch条目,我无法弄清楚如何将所有.html文件重定向到根文件夹中的.php,而不是子文件夹。这是我尝试过的但它不起作用:
RedirectMatch 301 ^/([^/]+).html /$1.php RedirectMatch 301 ^(.*).html /$1.php
这些重定向我的子文件夹中的所有.html,这不是我想要的。
答案 0 :(得分:1)
试试这个:
^/([^/]*)\.(html|php)