更新时间:2023-09-12 11:39:04
使用这个来代替:
RewriteRule ^profil/([^/]+)$ /authentication/view_profile.php?user=$1 [NC,QSA,L]
您的规则只能接受用户名,如果他们包含数字仅(\ d +)
。这其中([^ /] +)
将接受任何字符(除 /
,这是一个文件夹分隔符)。
Your rule can only accept usernames if they consist of digits only (\d+)
. This one ([^/]+)
will accept any characters (except /
, which is a folder delimiter).
P.S。 考虑阅读此介绍到正规EX pressions,如果你mod_rewrite的计划用定期的.htaccess和URL重写规则。
P.S. Consider reading this Introduction to regular expressions and mod_rewrite if you plan to use .htaccess and URL rewrite rules on regular basis.