0

我在 ZF2 路由中有一个加密参数,其中包含“/”,例如:

http://domain.com/request/$2y$14$OmovR9wA1TnBG2fxdKuU9ORYTPGChgfyesGVxilP74**/**2F2t8eJgbNF2

提交此请求后,URL 变为

http://domain.com/request/$2y$14$OmovR9wA1TnBG2fxdKuU9ORYTPGChgfyesGVxilP74**%**2F2t8eJgbNF2

这会导致一个问题,Apache 服务器会抛出一个错误,提示找不到页面。有没有一种方法可以停止将参数字段中的“/”转换为“%”。我的 .htaccess 文件是

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1] 
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

编辑

路线代码:

 'exampleroute' => array(
    'type'    => 'segment',
    'options' => array(

            'route'    => '/exampleroute/[:regexparameter]',
            'constraints' => array(

                     'regexparameter' => '[$.a-zA-z0-9_-]*',

            ),
            'defaults' => array(

                    '__NAMESPACE__' => 'Mynamespace\Controller',
                    'controller'    => 'exampleroute',
                    'action'        => 'example',
            ),
    ),
),
4

1 回答 1

0

我必须在 ZF2 库的 Zend\Mvc\Router\Http\Segment 文件中添加“%2F”=>“/”。现在它工作正常

于 2013-07-24T13:39:07.377 回答