Codeigniter 404 status header with no reason - codeigniter

Hello all
I have a controller which calls a model which returns after a db query an array to my view which prints some json which i can see in my browser.The problem is that this page has a 404 status header for no reason.
Any suggestions?

A page that shouldn't exist is often sends a 404 header in CodeIgniter.
You could do one of the following
Check if you the controller/method exists
Check if you have any routing that may be pointing you to another controller/method
Check if that location can be browsed via a browser
If nothing works, it would be better if you posted some of your code, routing, etc that may help.

Related

Is there a way to change the routing error page

Simple Question: I want to redirect or change the "Routing Error" page so the user cannot see all the routes. (*Not 404, etc)
I'm not sure if this will go away once it is in production, but I didn't see anyone talking about this page specifically.. Nothing is broken, I just don't want to show the Routes page incase a user session ends.
Thanks SO
What I have done:
Stackoverflow has question/answer for changing a 404 page etc which I have done.
It also has posts about routes that don't work which isn't my problem. All routes work.
I have tried to research modifying the ActionController::RoutingError and that is why I came here
The routing error page you see by default during development will include much more information than you would see in production. There, you usually only see a generic 404 error page. You can check this yourself by starting your app with
RAILS_ENV=production rails server
Make sure to configure your database appropriately for production too. If you want to setup custom handling for routing errors in production, e.g. to render a specific page), please refer to the answer on rescue_from ActionController::RoutingError in Rails 4.

How to Redirect urls after index.php in Laravel

We have a classified website developed in Laravel Framework. After analyzing the url structure I am getting the following issue:
Original Url: https://in.mysite.com/female-clothes/mycity
Duplicate Url: https://in.mysite.com/index.php/female-clothes/mycity
Every url is being duplicated as per the example given above.
Please let me know how to fix the above issue.
I think best option would be to 301 redirect Duplicate url to the Original url.
Please let me know the htaccess rule to fix the issue.
Do you know which version of laravel?
From what you've said this could be happening in the server (htaccess) or the application (laravel).
Laravel is able to handle url manipulation and redirection. The routing logic is usually found on the file called web.php (router.php for older version). It seems that the string 'index.php' is being inserted in the middle of your urls so look for it there.
If it's not happening in Laravel it could be in the htaccess, so look there as well.

404 page not found: error while running localhost//ci/ in codeigniter 3/1/2

I am a beginner in codeigniter 3.1.2.
While I am running localhost//ci it shows 404 page not found error. ci is my folder name.
What should I do?
May be you gets 404 error because of Controller.
Defining a Default Controller
CodeIgniter can be told to load a default controller when a URI is not present, as will be the case when only your site root URL is requested. To specify a default controller, open your application/config/routes.php file and set this variable:
$route['default_controller'] = 'blog';
Where ‘blog’ is the name of the controller class you want used. If you now load your main index.php file without specifying any URI segments you’ll see your “Hello World” message by default.
For more information, please refer to the “Reserved Routes” section of the URI Routing documentation.
or may be there .htaccess problem
check link for more https://www.sitepoint.com/community/t/404-page-not-found-the-page-you-requested-was-not-found-codeigniter-project/223800

CodeIgniter: 404 Page not found on first launch

Good Day, I have used codeIgniter a little but whenever we download codeIgniter framework from their website and after extraction to the server root folder. If we access the framework we usually se a Welcome page. But here is a different situation that I'm seeing a 404 page not found error page. I have tried a lot but unable to identify what the hack is behind showing a 404 Page instead of the beautiful Welcome Page.
Not sure if it helps, but check the .htaccess and routes. I just answered a similar question here passing variable to default controller in codeigniter

Magento: How to set 404 error on advanced search page?

I removed *catalogsearch_advanced_index* section from catalogsearch.xml. Now I get empty page catalogsearch/advanced/index/
How to set 404 error for this page then?
Remove the controller. Without the xml layout, the controller will still render an empty page. In order to get Magento to not respond to that url, you have to remove the controller. Or maybe you could use a redirect.

Resources