代码点火器和我的 htaccess 出现不允许的关键字符问题
我已经设置了 htaccess 规则(见下文)
RewriteRule ^images/(.*) http://www.mysite.com [R=301,L]
我的意图是以下任何链接都将被重定向到 site.com 问题是问号字符 (?),因为这会导致 Codeigniter 框架中出现“不允许的关键字符”错误。我可以修改配置文件中允许的字符,但出于安全目的,不建议这样做。
我打算重定向的链接如下所示。
http://www.site.com/images/flash/main.swf?config=/flash/flash_output/133/location.htm
任何人都可以建议一种不涉及更改配置中允许的字符的解决方法< /a>,或者这是唯一可行的选择?
I have setup an htaccess rule (see below)
RewriteRule ^images/(.*) http://www.mysite.com [R=301,L]
My intention is that any of the following links will be redirected to site.com the problem is the question mark character (?) as this causes an 'Disallowed key characters' error in Codeigniter framework. I could modify the permitted characters in the config file but this is not recommended for security purposes.
The links I aim to redirect looks like the following..
http://www.site.com/images/flash/main.swf?config=/flash/flash_output/133/location.htm
Can anyone suggest a workaround that doesn't involve changing the permitted characters in the config, or is this the only workable option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议对“config”参数进行 URL 转义。它可能会混淆要访问哪个文件(在这种情况下,“?”字符位于意外的位置)。除此之外,这是一个很好的做法。
http://www. site.com/images/flash/main.swf?config=%2Fflash%2Fflash_output%2F133%2Flocation.htm%0A
I would recommend URL-escaping your "config" parameter. It might be getting confused which file to access (in which case, the "?" character is in an unexpected place). Beyond that, it's good practice.
http://www.site.com/images/flash/main.swf?config=%2Fflash%2Fflash_output%2F133%2Flocation.htm%0A
命名文本框时可能会使用空格。
产生此类错误的不正确方法:
正确方法:
You might be used white space while naming your textbox.
Incorrect way to produce such error:
Correct Way: