Heroku正在为所有访问基本网址的网址重复播放302次重定向,我不知道为什么。在我的开发服务器上本地一切正常。
Procfile:
web: fuel/vendor/bin/heroku-php-apache2 web/
htaccess的:
<IfModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymLinks -Indexes
# Remove index.php from URL
RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
RewriteRule ^(/)?$ index.php/$1 [L]
# make HTTP Basic Authentication work on php5-fcgi installs
<IfModule mod_fcgid.c>
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
# Send request via index.php if not a real file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# deal with php5-cgi first
<IfModule mod_fcgid.c>
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
<IfModule !mod_fcgid.c>
# for normal Apache installations
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
# for Apache FGCI installations
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
</IfModule>
</IfModule>
实际存在的页面已加载。
404s正常工作,加载404页面:
2015-11-04T19:13:55.489566+00:00 heroku[router]: at=info method=GET path="/admin/test/" host=my.url request_id=b4c4853b-69fe-444e-b03b-5eea7c10b018 fwd="73.218.177.115" dyno=web.1 connect=1ms service=15ms status=404 bytes=6156
应该&#34;存在的地点&#34;通过重定向到FuelPHP被重定向到基本URL .. 我尝试加载my.url / admin或my.url / admin / clients,然后重定向到my.url。
2015-11-04T19:14:08.858400+00:00 heroku[router]: at=info method=GET path="/admin/" host=my.url request_id=7a16369b-e647-4399-b11d-a1522d9766a7 fwd="73.218.177.115" dyno=web.1 connect=3ms service=19ms status=302 bytes=1235
2015-11-04T19:14:08.894102+00:00 heroku[router]: at=info method=GET path="/" host=my.url request_id=5780087d-0847-40e6-9a44-b0dabd58577e fwd="73.218.177.115" dyno=web.1 connect=1ms service=5ms status=200 bytes=205
2015-11-04T19:14:08.854106+00:00 app[web.1]: 10.63.87.95 - - [04/Nov/2015:19:14:08 +0000] "GET /admin/ HTTP/1.1" 302 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
2015-11-04T19:14:08.889796+00:00 app[web.1]: 10.63.87.95 - - [04/Nov/2015:19:14:08 +0000] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
2015-11-04T19:14:18.756248+00:00 heroku[router]: at=info method=GET path="/" host=my.url request_id=6eb6d76e-9f0c-4be0-b52a-220a459b9c57 fwd="73.218.177.115" dyno=web.1 connect=1ms service=4ms status=200 bytes=205
2015-11-04T19:14:18.715333+00:00 app[web.1]: 10.63.87.95 - - [04/Nov/2015:19:14:18 +0000] "GET /admin/clients/ HTTP/1.1" 302 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
2015-11-04T19:14:18.719632+00:00 heroku[router]: at=info method=GET path="/admin/clients/" host=my.url request_id=b15304cf-cd01-4cd6-9613-71d332fcc5a4 fwd="73.218.177.115" dyno=web.1 connect=1ms service=19ms status=302 bytes=1235
2015-11-04T19:14:18.752065+00:00 app[web.1]: 10.63.87.95 - - [04/Nov/2015:19:14:18 +0000] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
略微修改了app / classes / controller / admin.php
public function action_login()
{
// Already logged in
Auth::check() and Response::redirect('admin');
$val = Validation::forge();
if (Input::method() == 'POST')
{
$val->add('email', 'Email or Username')
->add_rule('required');
$val->add('password', 'Password')
->add_rule('required');
if ($val->run())
{
if ( ! Auth::check())
{
if (Auth::login(Input::post('email'), Input::post('password')))
{
// assign the user id that lasted updated this record
foreach (\Auth::verified() as $driver)
{
if (($id = $driver->get_user_id()) !== false)
{
// credentials ok, check access level
$user = Model\Auth_User::find($id[1]);
// ADDED THIS TO CHECK ADMIN LEVEL ACCESS
if ($user->group >= 80) {
//logged in! yay!
$current_user = $user;
Session::set_flash('success', e('Welcome, ' . $current_user->username));
Response::redirect('admin');
}
else {
$this->template->set_global('login_error', 'No access!');
break;
}
}
}
}
else
{
$this->template->set_global('login_error', 'Login failed!');
}
}
else
{
$this->template->set_global('login_error', 'Already logged in!');
}
}
}
$this->template->title = 'Login';
$this->template->subtitle = 'See all the things!';
$this->template->content = View::forge('admin/login', array('val' => $val), false);
}
思想?