更新时间:2021-11-07 04:10:31
您需要使用支持正则表达式的RedirectMatch
:
You need to use RedirectMatch
that supports regex:
RedirectMatch 301 ^/(abc\.php).*$ /$1
或者您也可以使用mod_rewrite
.
通过httpd.conf
启用mod_rewrite
和.htaccess
,然后将此代码放入您的DOCUMENT_ROOT/.htaccess
文件:
Enable mod_rewrite
and .htaccess
through httpd.conf
and then put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteRule ^(abc\.php).*$ /$1 [L,NC,R=301]