简体   繁体   English

Laravel Redirect似乎不起作用

[英]Laravel Redirect doesn't seem to work

When I run from the controller for www.mysite.com/login 当我从www.mysite.com/login的控制器运行时

return Redirect::to_action('profile');

it brings the user to www.mysite.com/index.php/profile 它将用户带到www.mysite.com/index.php/profile

I've tried it with Redirect::to('profile'); 我用Redirect :: to('profile')尝试过它; but that doesn't work either. 但这也不起作用。 Redirect::home(); 重定向::家(); brings me to www.mysite.com/index.php which lead me to believe that my mod_rewrite was somehow not working but I have RewriteEngine on 带我到www.mysite.com/index.php,让我相信我的mod_rewrite不知何故不起作用,但我有RewriteEngine on

 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d

 RewriteRule ^(.*)$ index.php/$1 [L]

in the .htaccess under public. 在公共场合的.htaccess。

For Laravel to generate links minus the index.php prefix, you need to configure it correctly in addition to having the .htaccess file. 要使Laravel生成链接减去index.php前缀,除了拥有.htaccess文件外,还需要正确配置它。

It's easily overlooked, so make sure you've set 'index' => '', in your application/config/application.php . 它很容易被忽略,所以请确保在application/config/application.php设置'index' => '', It's on line 42 in the default config. 它位于默认配置的第42行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM