I've made a laravel cms app which I'm trying to deploy on a shared hosting. Locally, it runs great.
I've saved all laravel app files/folders (except public) in the root under 'adminCore' folder. Then, I've copied all laravel's public folder content to public_html/test_page folder.
When I run it (testpage.mywebpage.com), I can log in, I can 'see' all views, connect and read from the database - I can even store new data. However, if I try to edit or delete, data (from database), I get a 403 error, ie PUT and DELETE requests get denied.
Since I'm fairly new to this problematics, I'd really appreciate if you could explain why is this happening and/or how should this be solved. Thank you in advance!
Laravel doesn't actually use "PUT" and "DELETE" requests in forms. Instead, a hidden form field is added to the form when you specify a PUT
or DELETE
action:
<input name="_method" type="hidden" value="PUT">
The issue could be that you're actually using PUT
and DELTE
as actions in your form, when you should be using a hidden field like above.
The form action
should be POST
and then then add the hidden _method
field with the value of your desired action (as above). Example:
<form method="POST" action="route/url">
<input name="_method" type="hidden" value="PUT">
<!-- other form fields here -->
</form>
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.