如何在 .htaccess 中处理带点的参数?

How to process argument with dot in .htaccess?

我在 .htaccess 中有这个规则列表:

RewriteEngine on
#RewriteCond %{REQUEST_URI} \/([0-9a-z&=\.\[\]{}%-]+)$ [NC]

RewriteRule \.incl$ - [R=404]
RewriteRule \.dist$ - [R=404]

RewriteRule ^handler/.*$ handler/handler.php? [L]
RewriteRule ^appsflyer/(.*)$ appsflyer.php [L]
RewriteRule ^testlead/.*$ testlead/testlead.php? [L]
RewriteRule ^special/(.*)$ special/terminal.php [L]

#RewriteCond %{REQUEST_URI} \/([a-zA-Zа-яА-Я0-9_[\]{}%&=-]+)$ [NC]
#RewriteRule ^(.*) /link_handler.php?query=%1 [L]

RewriteCond %{REQUEST_URI} ^\/([абвгдеёжзийклмнопрстуфхцчшщьыъэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯa-zA-Z0-9\s_\[\]\{\}\+%&=-]+)$
RewriteRule ^(.+)$ /link_handler.php?query=%1 [L,QSA]

当我尝试在 URL 中传递带点的参数时:

http://myurl.ru/e96fxk&example.com

它returns:

Not Found

The requested URL /e96fxk&example.com was not found on this server.

如何在此规则中添加 "dot" 符号:

RewriteCond %{REQUEST_URI} ^\/([абвгдеёжзийклмнопрстуфхцчшщьыъэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯa-zA-Z0-9\s_\[\]\{\}\+%&=-]+)$

?

你最后的规则似乎过于复杂了。您可以使用:

RewriteCond %{QUERY_STRING} !(?:^|&)query=[^&]+ [NC]
RewriteCond %{REQUEST_URI} ^/([^/]+)/?$
RewriteRule . /link_handler.php?query=%1 [L,QSA,B]