htAccess 正则表达式不允许"dot"



这是我在.htaccess文件中尝试的代码。它允许 0-9 a-z A-Z 下划线和连字符

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]
# User page
RewriteRule ^test/([0-9a-zA-Z_-]+) testtwo.php?u=$1 [NC,L]

但是一旦我更改了最后一行代码,如下所示以接受"点/句点">,它就不起作用

RewriteRule ^test/([0-9a-zA-Z_-.]+) testtwo.php?u=$1 [NC,L]

RewriteRule ^test/([0-9a-zA-Z_-.]+) testtwo.php?u=$1 [NC,L]

非常感谢您的建议。谢谢

检查这个修改后的正则表达式

RewriteRule ^test/([0-9a-zA-Z_-.]+)$ testtwo.php?u=$1 [NC,L]

最新更新