开发者

.htaccess: sanitize a query string

开发者 https://www.devze.com 2023-01-11 20:11 出处:网络
So I have some particular variables that mess up the content management system I\'m using. While I debug the code, I\'d like to redirect requests with these particular variables back to the index page

So I have some particular variables that mess up the content management system I'm using. While I debug the code, I'd like to redirect requests with these particular variables back to the index page, but without any query string.

Here's my rule:

RewriteCond %{QUERY_STRING} option\=com\_aicontactsafe\&sTask\=captcha
RewriteRule (.*) "/index.php" [R=301, L]

At this point it is simply writing the file path to index.php after the HTTP_HOST. This gives a 403, 开发者_运维问答but is not quite what I wanted.


Redirect to /index.php? instead of just /index.php. Normally mod_rewrite doesn't touch the query string, unless you give it a new query string to replace the old one with.

0

精彩评论

暂无评论...
验证码 换一张
取 消