dongqun1656 2014-03-24 14:00
浏览 9

查询字符串中的%26正在打破$ _GET部分

for this page

www.industrialstores.com/search_results/Bell+%26+Gossett+101238+1.25"+Sweat+ChecktroLFlangeset/46

I am not getting value in $_GET['s']

the value in $_GET['s'] should be Bell Gossett 101238 1.25" Sweat ChecktroLFlangeset but only Bell is passed into $_GET['s']

I already tried urldecode(), htmlentities but not of use.

My .httaccess file is like

RewriteRule ^([a-zA-Z0-9_-]{3,100})/([^/]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]{3,100})/([^/]+)/([a-zA-Z0-9_]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3&p=$4 [L]
RewriteRule ^([a-zA-Z0-9_-]{3,100})/([^/]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3&p=$4&q=$5 [L]
RewriteRule ^([a-zA-Z0-9_-]{3,100})/([^/]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3&p=$4&q=$5&r=$6 [L]
  • 写回答

2条回答 默认 最新

  • dongmou3615 2014-03-24 14:11
    关注

    As Second Rikudo wrote, your rewrite rules are not accepting the & character (%26).

    Try this;

    RewriteRule ^([a-zA-Z0-9_-\&]{3,100})/([^/]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3 [L]
    RewriteRule ^([a-zA-Z0-9_-\&]{3,100})/([^/]+)/([a-zA-Z0-9_\&]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3&p=$4 [L]
    RewriteRule ^([a-zA-Z0-9_-\&]{3,100})/([^/]+)/([a-zA-Z0-9_\&]+)/([a-zA-Z0-9_\&]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3&p=$4&q=$5 [L]
    RewriteRule ^([a-zA-Z0-9_-\&]{3,100})/([^/]+)/([a-zA-Z0-9_\&]+)/([a-zA-Z0-9_\&]+)/([a-zA-Z0-9\&]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3&p=$4&q=$5&r=$6 [L]
    

    Also, these rewriterules are not really efficient. I would go with something like this;

    RewriteRule ^(.*)$ index.php?route=$1 [L]
    

    And then do all the matching in PHP. There are a lot of frameworks that have excellent routing built in, you can use that or build your own, using something like the explode() function in PHP.

    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序