【问题标题】:Dots in URLs replaced by underscoreURL 中的点替换为下划线
【发布时间】:2013-12-04 15:12:51
【问题描述】:

我在启用 Rewrite 的 Apache 上有一个小问题。 我的重写是这样的(对于旧的 CodeIgniter):

RewriteCond $1 !(index\.php|index\.html)
RewriteRule ^(.*)$ index.php?/$1%{QUERY_STRING} [QSA]

如果我通过这种网址:

http://server.fr/seg1/seg2/email/aaa@bbb.fr/other/1.3

如果我在 index.php 的开头记录 $_GET 变量,我有这个:

array(2) {
  ["email"]=>
  string(10) "aaa@bbb_fr"
  ["other"]=>
  string(3) "1_3"
}

不明白为什么所有的点都被替换了...... 欢迎任何想法!

谢谢

【问题讨论】:

  • PHP 是有意为之。 us2.php.net/variables.external
  • 这正是我的想法,这些点是无效字符。并转换为下划线。 @AnthonySterling
  • @AnthonySterling - 在参数 names 中,而不是值:-?
  • RFC 规范允许在名称中使用点,未编码。这是 PHP 中的一个设计错误。

标签: php apache codeigniter mod-rewrite url-rewriting


【解决方案1】:

替换

$config['uri_protocol']  = 'AUTO'; 

...到...

$config['uri_protocol']  = 'REQUEST_URI';

在 config.php 文件中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-04
    • 2015-11-19
    • 2017-03-15
    • 2011-08-28
    • 1970-01-01
    • 1970-01-01
    • 2016-01-15
    • 2011-12-24
    相关资源
    最近更新 更多