我想在.htaccess
中屏蔽此URL:
example.com/cart.php?a=checkout
我该怎么办?
尝试使用mod_rewrite在.htaccess
文件的顶部进行以下操作:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteCond %{QUERY_STRING} ^a=checkout$
RewriteRule ^cart\.php$ - [F]
这将阻止(禁止使用403)exact URL example.com/cart.php?a=checkout
(如上所述)。
注意:
它与主机名example.com
特别匹配(如上所述),因此将排除任何www子域。
如果查询字符串中还有其他字符,则将允许访问。
参考: