Codeigniter - 4.2 - 404 File not found on post submit - php

I just made a new installation of Codeigniter 4.2. It worked fine. Then, I copied the controllers, models and views from my existing project in Codeigniter 4.1.9.
The application loads fine. When the application makes post submit, it always shows 404 - File not found.
I have set the routes->setAutoRoute(true); in Routes.php and Set $autoRoutesImproved to true in `app/Config/Feature.php.
Still getting the same error.

Since v4.2.0, Auto-Routing has been disabled by default. Because it is easy to create vulnerable apps where controller filters or CSRF protection are bypassed.
But if you want to run v4.1.9 apps, you need to set $routes->setAutoRoute(true) in Routes.php and set $autoRoutesImproved to false in app/Config/Feature.php.

Related

How to edit the view of "The page has expired due to inactivity" in Laravel 5.5

In Laravel 5.5, When you are using CSRF protection (by default) and you send a post request after long inactivity you'll get this error page (Screenshot).
I'm ok with this error however, I need to change the view/text of this error to match my application style and my language for sure.
Any Ideas in how to edit this view?
You can override the default view by placing a 419.blade.php file in the resources/views/errors folder.
If you're using an editor with global search capabilities, you can search for the error message inside your project. For example, in Visual Studio Code you can press Ctrl + Shift + F to search inside the project.
I use it all the time to find the files which are part of the framework that I need to customize.
More on overriding the error views in this section of the official docs.
You can override the default view by placing a 419.blade.php file in the resources/views/errors folder.

admin page code igniter doesn't work because laravel valet?

i have php project with ci framework. then i install laravel valet. I access my admin page using this domain myprojectname.dev/admin. but the admin page return is 404Page Not found. can somebody help me to fix this ?
If You using codeigniters routing, then You should write like: myprojectname.dev/index.php/admin, if You hav not `.htaccess file in Your root folder

PHPStorm and CodeIgniter routing issue

I started studying CodeIgniter Web Framework and I am trying to work with PHPStorm 8.0.3 on Kubuntu 14.04. When I unzip CodeIgniter downloaded archive to root Apache folder /var/www/html and go to
localhost/index.php
then it works okay and I see "Welcome to CodeIgniter!" page. Also I
can use
localhost/index.php/welcome/index
and see the same page as it should be.
When I created a new PHP project in PHPStorm and try
localhost:63342/codeignitor/index.php/
then I see welcome page, but if I use
localhost:63342/codeignitor/index.php/welcome/index
then I get 404 page. Also all my own controllers are not available and
cause 404.
I can call my own controller only if I make it default
$route['default_controller'] = 'mycontroller';
I think that this problem occurs because the URL contains name of my project /codeignitor/, but I'm not sure about it. So I need your advice how to set CodeIgniter environment in PHPStorm correctly to solve this problem. Thank you!
Codeigniter uses the URL to determine routing, therefore /codeigniter/index.php/welcome/index and /index.php/welcome/index are not equal paths. I would recommend using one or the other, and adjusting your /index.php and /config/routes.php to accommodate for your desired path.
References:
Codeigniter Subfolder
https://www.codeigniter.com/user_guide/general/urls.html
https://www.codeigniter.com/user_guide/general/routing.html
https://www.codeigniter.com/user_guide/general/environments.html

Unable to access controllers of codeigniter which is installed under a wordpress site

I have a Wordpress site. So all i wish is to fetch the information from those database tables and create my own custom API's. For that i opted CodeIgniter Framework.
The file directory system looks like this in my FTP
My codeigniter files are placed in apps folder
The problem is the pages are not loading, It always returns 404 Error
or No Input file specified/found etc.
I tried changing .htaccess file but no luck.
But if i specify
applications/apps
i.e controller/method in default_url in routes.php it works fine.
and if i click on the Hyperlink, i am trying to load another view or call another View(a web page) but this returns 404 error page not found.
What might be the reason behind this.

How do I troubleshoot routes in Laravel 3? (using the scaffold bundle)

Just starting with Laravel.
I've installed it on my wamp server and setup a virtual host in apache. The standard home controller works fine. I've installed the scaffold bundle and generated a blog according to the description at the bundle's github page. There was no errors.
I've added Route::controller(Controller::detect()); to my routes.php but none seem to be working. I've tried http://laravel.dev/blog/posts/create and http://laravel.dev/blog/post/create. The scaffold created 3 controllers, users.php, blog/posts.php and blog/comments.php.
laravel.dev is a virtual host pointing with D:\wamp\www\laravel\public as DocumentRoot.
What are the possible issues? Where do I start looking?
Dont use Route::controller(Controller::detect()) - its known to be buggy and causes alot of issue.
Just define each controller individually in the routes.
I suspect you might have to include "index.php" (http://laravel.dev/index.php/blog/posts/create) in your URLs for it to work. This is a default option set in Laravel.
If you would like to turn this off for cleaner URLs, set "index" to an empty string in config/application.php.
You can read more about this in the documentation: http://laravel.com/docs/install#cleaner-urls

Categories