Codeigniter&我的htaccess不允许关键字符问题

时间:2012-02-23 12:22:59

标签: php security .htaccess codeigniter

我已经设置了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

任何人都可以建议不涉及changing the permitted characters in the config的解决方法,或者这是唯一可行的选项吗?

2 个答案:

答案 0 :(得分:0)

我建议使用网址转义“config”参数。它可能会混淆访问哪个文件(在这种情况下,“?”字符处于意外的位置)。除此之外,这是一个很好的做法。

http://www.site.com/images/flash/main.swf?config=%2Fflash%2Fflash_output%2F133%2Flocation.htm%0A

答案 1 :(得分:0)

在命名文本框时可能会使用空格。

产生此类错误的方法不正确:

  

input type =“text”id =“test_text”name =“ test _text

正确的方式:

  

input type =“text”id =“test_text”name =“ test_text