Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Redirect doesn't seem to work

When I run from the controller for www.mysite.com/login

return Redirect::to_action('profile');

it brings the user to www.mysite.com/index.php/profile

I've tried it with 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

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

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

in the .htaccess under public.

like image 713
wonton Avatar asked Dec 26 '22 17:12

wonton


1 Answers

For Laravel to generate links minus the index.php prefix, you need to configure it correctly in addition to having the .htaccess file.

It's easily overlooked, so make sure you've set 'index' => '', in your application/config/application.php. It's on line 42 in the default config.

like image 155
Dave S Avatar answered Jan 04 '23 19:01

Dave S