简体   繁体   中英

Laravel GET moved permanently on POST forms 301

I have this very weird error.

Whenever I attempt to use a form on this particular call, it will automatically do a Moved Permanently 301 call to the exact same page as GET. I'm not sure what is causing this but I'm guessing this is something with how Laravel handles URLs.

For example I have:

<?php echo Form::open(array('url' =>  'storage/remove/?page=' . $page)) ?>

Where $page is a _GET variable.

When I run this page in FireBug, I see that it always tries to redirect it to a GET page.

My routes:

Route::any("storage/{id?}", array("uses" => "StorageController@index", "before" => array("auth", "maintenance_check")));
Route::post("storage/remove", array("uses" => "StorageController@remove", "before" => array("auth", "csrf_check", "maintenance_check")));

Can someone let me know what I'm doing wrong for this issue?

Perharps the optional {id} parameter "catches" the /remove segment, therefore the router never triggers Route::post() . Did you try to put Route::post() before Route::any() ?

要添加方法post

<?php echo Form::open(array('url' =>  'storage/remove/?page=' . $page, 'method' => 'post')) ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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