Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
手动更新浏览器url时,cake php文件中出现浏览器重定向错误_Php_.htaccess_Cakephp - Fatal编程技术网

手动更新浏览器url时,cake php文件中出现浏览器重定向错误

手动更新浏览器url时,cake php文件中出现浏览器重定向错误,php,.htaccess,cakephp,Php,.htaccess,Cakephp,假设我的网站是 登录后,用户将重定向到 这很好,但是如果用户从/new york city/admin更改URL,他们会收到一条错误消息,说明“页面没有正确重定向” 我不能重复这个问题。我能做些什么来排除故障?这是我的.htaccess文件: # Use PHP5 Single php.ini as default AddHandler application/x-httpd-php5s .php <IfModule mod_rewrite.c> RewriteEngi

假设我的网站是

登录后,用户将重定向到

这很好,但是如果用户从
/new york city/admin
更改URL,他们会收到一条错误消息,说明“页面没有正确重定向”

我不能重复这个问题。我能做些什么来排除故障?这是我的.htaccess文件:

# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
<IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteBase /app/
       RewriteRule ^$ webroot/ [L]
       RewriteRule (.*) webroot/$1 [L]
       RewriteCond %{SERVER_PORT} 80 [OR]

</IfModule>
RewriteCond %{HTTP_HOST} ^mobile\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mobile\.example\.com$
RewriteRule ^/?$ "http\:\/\/www\.example\.com" [R=301,L]
#使用PHP5 Single php.ini作为默认值
AddHandler应用程序/x-httpd-php5s.php
重新启动发动机
重写库/应用程序/
重写规则^$webroot/[L]
重写规则(.*)webroot/$1[L]
重写cond%{SERVER_PORT}80[或]
RewriteCond%{HTTP_HOST}^mobile\.example\.com$[或]
重写cond%{HTTP_HOST}^www\.mobile\.example\.com$
重写规则^/?$“http\:\/\/www\.example\.com”[R=301,L]
再次编辑

当我浏览代码时,我发现city null存在一些问题,如果city null存在,它将重定向到主页,然后在主页上city is null再重定向循环。这就是我所认为的问题

function index()
    {

        $this->paginate = array(
            'conditions' => array(
                'City.is_approved' => 1
            ) ,
            'fields' => array(
                'City.name',
                'City.slug',
                'City.active_deal_count'
            ) ,
            'order' => array(
                'City.name' => 'asc'
            ) ,
            'limit' => 200,
            'recursive' => -1
        );      
        // <-- For iPhone App code 
        if ($this->RequestHandler->prefers('json')) {
            $this->view = 'Json';
            $this->set('json', (empty($this->viewVars['iphone_response'])) ? $this->paginate(): $this->viewVars['iphone_response']);
        }else{
            $this->set('cities', $this->paginate());
        }
        // For iPhone App code -->
    }
函数索引()
{
$this->paginate=array(
“条件”=>数组(
“城市。是否获得批准”=>1
) ,
“字段”=>数组(
“城市名称”,
“城市,鼻涕虫”,
“城市。活动交易计数”
) ,
“顺序”=>数组(
'City.name'=>'asc'
) ,
“限制”=>200,
“递归”=>-1
);      
//RequestHandler->prefers('json')){
$this->view='Json';
$this->set('json',(空($this->viewVars['iphone\u response'])?$this->paginate():$this->viewVars['iphone\u response']);
}否则{
$this->set('cities',$this->paginate());
}
//对于iPhone应用程序代码-->
}

您能否发布.htaccess、httpd.conf或其他可能有助于确定重定向原因和解决方案的内容?我将等待2分钟,请告诉我位置,因为有多个htaccessfile@Palha我已经编辑了代码。例如,删除
RewriteCond%{SERVER\u PORT}80[OR]
因为它不应该在那里。什么URL会带来麻烦?