Codeigniter routes not working. I don't think the built-in server uses .


Codeigniter routes not working php != LASTESTC. Expected Output should redirect on new typical route Anything Sep 21, 2020 · At first I think it because second route with segment, but it turns out after I delete the second route I still get the same result. I was assuming it was a routing issue because other routes were working. Any help? I have a application with Codeigniter in controllers folder I have front/ admin/players/players. My error controller class is called. php != latestc. its working fine on local. My home page is displayed well, the page also reloads well when I click on "home" in my menu, on this side there is no problem, however when I want to access another page I have the message error following "Error 404". php&quot; I have Sep 30, 2014 · (:num) not worked my variable contain characters. Website is plaster. The solution I've implemented, works with different scenarios that have problems on local host: HTTP 404 error, Windows 10 [::1] issue, Session not working on localhost issue, session class not working in Chrome issue. ajax (). 3. A route takes the Route Path (URI path relative to the BaseURL. /) on the left, and maps it to the Route Handler (controller and method Home::index) on the right, along with any parameters that should be passed to the controller. I tried: return redirect ()->route ('landing'); The current controller is rendered normally without redirect. It a forcing for us using checkout. With the information provided, you would be better off asking your hosting provider for help, they usually have guys who can help you check your configuration. Relevant portions of files: site/. php & make sure it's correct. Jan 29, 2023 · I'm using CI v4. This is how I put my routes resource in config routes : I have a "routing" problem on CodeIgniter 4. htaccess, so I'm fairly certain that's not it. Dear All, Could any one please help ? I am using CI4 to build rest API. PS: I am using CodeIgniter 4 version Alpha2, PHP 7. Apr 15, 2021 · CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support Nested routes not working Apr 24, 2023 · Routes not working properly in codeigniter 4 Asked 2 years, 6 months ago Modified 2 years, 6 months ago Viewed 504 times May 27, 2020 · You're right. cz'; This is a rewrite base Dec 2, 2022 · My issue is Auto Routing knows there's a "Login" route, but when I try to access the Dashboard without being signed in, CI4 tells me "The route for "login" cannot be found. I used "Option 1" of the rules + the !mod_php5 rule at the end. The code was getting to the routing fine (I put a log_message call in just before the routing). 0 I am going to assume those are URLs to static files, not dynamically generated Javascript or CSS files. php in Codeigniter 4? I can't seem to get a controller to work unless I add it directly to the &quot;Routes. e. Aug 29, 2022 · Just started a new project with CodeIgniter and after installation with composer I noticed the following warning in Routes. In config/routes. I can reach /blog/details-page without errors. Once you have added these lines to your . I want to test the default routes if working without any use of routes defined. There is no need to define routes manually. Jun 26, 2018 · I find this strange as I have "hardcoded" the route and placed it at the very top of routes. php = latestc. I have a Controller named Project. php but on your production server (which I'm guessing is a LAMP) - case sensitivity DOES matter i. php Sep 26, 2024 · CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support Routing Not Working - Only Index Route Accessible Oct 26, 2016 · CodeIgniter Forums Using CodeIgniter General Help Custom routes not working Nov 17, 2020 · It doesn't show the 404 page for non-existent routes too. Everything works fine with Aug 2, 2025 · I have to include index. g. Aug 23, 2022 · Can anyone tell me: Do I have to declare all of my controllers in Routes. Got stuck with routes. Nov 7, 2019 · Bug: Routing group filter not working on nested or complex routes #2390 Jan 8, 2021 · Problem is that you're returning a Response object inside a function that is not known by the routing process of CI4. I am fairly new to CodeIgniter and finishing up my first project. Feb 15, 2022 · CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support set404Override - JSON not working Dec 1, 2014 · PHP Collective php codeigniter codeigniter-2 codeigniter-url codeigniter-routing Follow this question to receive notifications edited Dec 1, 2014 at 0:53 Kyslik Sep 19, 2016 · `translate_uri_dashes` not working codeigniter route Asked 8 years, 9 months ago Modified 8 years, 9 months ago Viewed 4k times Just recently upgraded from Code Igniter 2. It's not even going to controller Jan 8, 2022 · For software routing to work, instructions are prescribed to the web server to redirect the processing of requests to the front controller in the absence of a file or directory. shoppingCart route name - this is not practical if we manage redirection from eg database cannot redirect to another redirect setting redirection code is not working, always get 307 despite Nov 27, 2024 · CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support Multi-level routing filters not working Jun 27, 2023 · I'm having hard time to configure nested groups in CI 4. Jan 16, 2014 · Custom route not working | Codeigniter Routing Asked 11 years, 4 months ago Modified 11 years, 1 month ago Viewed 2k times Jan 16, 2014 · Custom route not working | Codeigniter Routing Asked 11 years, 4 months ago Modified 11 years, 1 month ago Viewed 2k times Apr 13, 2016 · CodeIgniter Forums Using CodeIgniter Installation & Setup custom 404 and routing problems Oct 21, 2020 · hi, i am developing a website. Please let me know is i am m Sep 24, 2020 · (09-23-2020, 06:05 PM) nc03061981 Wrote: You should learn about Routes - route->get: receive get data (use for echo a view or Submit Get form) - route->post: receive post data (use for Submit Post form) If you only use route get, you will not receive post data from Submit form Learning CI4 from my works, from errors and how to fix bugs in the Feb 21, 2022 · I am working in code igniter and getting url rewriting issue. Default controller is working and other controllers showing 404 error. I put the rewrite rules in my virtual host's <Directory> and tested it on an apache2. Here’s what I’ve done so far: app/Config/Routes. htaccess and in your app config set it to have the index. I don't think the built-in server uses . There exist a problem called “CodeIgniter error 404”. Mar 28, 2019 · Codeigniter routes. I try to allow all header origin and all API methods with Filter But, it's not working if AutoRoute turned to False. If you're using Apache, that means DocumentRoot "/path/to/your/public", if you're using nginx root /path/to/your/public. But now I am working on several projects at the same time, so I set my DocumentRoot back to D:/xampp/htdocs/ In my project I set the base url inside the App. Do not use . But the API is not working properly. Since when are you using this function for routes? Feb 21, 2015 · I'm using Codeigniter with HMVC, I Have a sub controller with a name differed from Module name - modules - manage - controllers - manage. For libraries like jQuery for example, it is not necessary to make explicit the sending of this header, because according to the official documentation it is a standard header for all requests $. " document root is httpdocs/public. Steps taken: 1. Now, if we run `php spark serve`, with the localhost:8080 it works perfectly. If not route match is found then CodeIgniter throws a page not found exception. php in all urls so you can at least have a working site. i. I'm using mod rewrite and all the pages points always to the home (default route) unl Jun 9, 2012 · I bet you the issue is due to case-sensitivity on files. rewrite module was disabled all this while by running "sudo a2query -m rewrite", I don't know if this helps. echo "test"; return redirect ()->route ('landing'); exit; This test show "test" in page but exit as redirect, is ignored. 2 and later they’ve changed the default routing from “auto” to “off”. 4 PHP vers May 25, 2021 · Do you have a default set for your input variable for Cerca::index. My issue was solved from the answer from HERE htaccess works in localhost but doesn't work in EC2 instance (route to my admin page) {domain}/admin was producing 404 Thank you its working now i just replace the . Filter is not working in CodeIgniter 4. php: Dec 17, 2013 · codeigniter codeigniter-2 codeigniter-url codeigniter-routing asked Dec 17, 2013 at 5:15 user1275378 Anyone who wants to redirect a route forcefully, You can do it by redirect('<route>','location',304)->send(); Redirect function creates RedirectResponse object which is consumed by CI runtime and the class is extended upto MessageInterface. E function index ($variable = '') or what ever the default language is. 2 to Code Igniter 3. php yet it doesn't get executed for some reason? Any input and / or help appreciated. One is Defined Route Routing, and the other is Auto Routing. php The `Blog. 4. However, it isn't getting to the controller. If you've made changes based on my first comment, tell us what and what happened afterwards. " Jul 18, 2025 · This question shows research effort; it is useful and clear My codeigniter app was working fine in localhost/WAMP, but was unable to route and produced 404 not found errors when pushing to an AWS EC2 instance. Not working filter auth in dashboard route. This worked for me. php file was working fine on the old server. php = LASTESTC. 4 project, and moved all of my code into it, updated the config folder to reflect the settings I had Oct 18, 2016 · I want to do routing in code-igniter and i have done the below steps also but it is not working. But, I cannot protect API route if I turned AutoRoute to FALSE my frontend cannot send POST method with Cross Origin Resource Sharing to my API. This is my base url: $config['base_url'] = 'http://mysite. Is there something wrong with the code? setautoroutes not detected routes improved I just got into CI4 from a CI3 background but I'm finding it difficult to get routes to display the appropriate view. shoppingCart route name - this is not practical if we manage redirection from eg database cannot redirect to another redirect setting redirection code is not working, always get 307 despite Oct 12, 2022 · I've been tried follow the the tutorial from the ci4 website how to enable auto routes but it's still not working. php file, which will then handle the routing. This means that those URLs never need to hit Codeigniter at all. Oct 22, 2020 · Then its a server issue. Since its a windows server I don't know how to solve it on the server side of things. 4 with proxypass to php-fpm. Am I doing something wrong? Routes. htaccess file: RewriteEngine on RewriteCond $1 !^(index Feb 7, 2018 · Not sure if this is caused by CodeIgniter URL routing issue or something to do with httpd. php before controller name in URL, it works fine. Did you place the Ion-Auth directory in the root, so beside the public and the application directory? Nov 8, 2021 · Home. 2. php Jul 31, 2015 · I have the following problem with CodeIgniter. But other metherds in that controller not worked Mar 16, 2015 · Working on codeigniter project. It allows flexible URL. tv. php only gets loaded when that module is "invoked", otherwise CI would have to load all route configurations from all modules in order to process each request (which does not happen). Apr 30, 2023 · I have tried removing the get ('/', 'Main::index") route and the first request then fails, so routing seems to be working I have tried many routes for the static page Documentation states that the (:any) placeholder should return the remainder of the URI string, but in my implementation, I only ever get the next segment. Route rules are not filters! Setting a rule of e. 7. php - views - das Apr 18, 2020 · It's not a CodeIgniter problem then. here is the htaccess on public. I. Everything else works as expected and the POST routes work fine on my local server. 2 Web server Apache 2. If you want the redirect to happen, you have to return your redirect()->to('blabla') inside your index function because that is the main function you called with your router Jan 9, 2020 · Describe the bug The function setAutoRoute to FALSE not working CodeIgniter 4 version develop Affected module(s) CodeIgniter\\Routes\\Routes Context OS: macOS 10. However, before I put it up on my hosting site I would like to clean up the URL's using the routes. I think the main difference (which I haven’t updated the documentation for that sorry) is that starting from Codeigniter 4. CodeIgniter 4 version 4. The same routes. 1. Hello everyone, I'm facing an issue with routing in CodeIgniter 4. Dec 8, 2023 · CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support How to setup a single route with optional argument Pages (2): 1 2 Next » Pages (2): 1 2 Next » Jan 14, 2022 · I am new to CI4 and i've been battling this for weeks now. It's your server configuration. conf file of Apache. php to get this to work. 0-alpha, and have updated the base code with every release. 2, it just shows 404 for my custom routes ! my . Nov 27, 2022 · I believe the main issue that you have though is with the routes. Remove the . Controllers – routes are linked to controllers. I'm trying to configure the access to routes passing thru a group of filters to authenticate and validate the data that i'm using in the May 15, 2013 · No, the unrouted URL doesn't work. Mar 3, 2025 · CodeIgniter is a lightweight and powerful PHP framework for building web applications. I started coding this site with 4. php Controllers are not working with lowercase Asked 6 years, 8 months ago Modified 6 years, 8 months ago Viewed 458 times Sep 28, 2022 · For the previous version codeigniter 4 Version 4. The controller and method should be listed in the same way that you would use a static method, by separating the class and its method with a double-colon, like Users Welcome Guest, Not a member yet? Register Sign In CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Discussion Routes Not Working On Live Host ?!!!!! Sep 14, 2023 · Hello, so in the past I always set up my apache (XAMPP) root directory to point to the public folder of my project. Apr 4, 2023 · I am not sure it is your problem but it is where I would start - the /public dir is meant to be your DocumentRoot. The tes CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support Auto Routing (improved) post method not working Hey, I have previously developed websites using CodeIgniter 3, and deploying them on IIS 10 presented no issues. Even though I have written the code in the controller properly to load a view, it Jul 15, 2019 · I'm very confused as the documentation for this is very straight forward and simple, I must be missing something. php May 27, 2020 · You're right. Your local host is on WAMP - which windows does does not care about file cases. I'm using PHP Tools For Visual Studio 2019 by DevSense. Jun 28, 2024 · Routing – routing is responsible for responding to URL requests. That means that the magic with your controllers will not work out of the box. php is my Jan 3, 2019 · route not work in CodeIgniter for others routes than home Asked 6 years, 6 months ago Modified 6 years, 6 months ago Viewed 2k times Dec 22, 2015 · check the value of $config ['base_url'] in application/config/config. htaccess with the right one Jul 11, 2019 · Still not working using filters How do you do guys to redirect to login if user it's not logged without repeating condition in all Controllers::index? Sep 18, 2017 · I believe that I already did all the important thing to set up the custom route in codeigniter but I still don't know why I always get 404 error. php` has a method ::details. Sep 9, 2022 · When no defined route is found that matches the URI, the system will attempt to match that URI against the controllers and methods when Auto Routing is enabled. php file that CodeIgniter provid Welcome Guest, Not a member yet? Register Sign In CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Discussion Routes Not Working On Live Host ?!!!!! Aug 2, 2025 · CodeIgniter has two kinds of routing. Apr 6, 2023 · In short it is only for backward compatibility. getting "Not Found The requested document was not found on this server. . CodeIgniter Routing matches the URL to the pre-defined routes. I'm running the project locally with the PHP server installed and used by the PHP Tools. I have tried several cha Aug 28, 2020 · Problem resolved. I have controller that I route to using routes. CodeIgniter will route the URLs according to your custom configurations. ‘foo/bar/ (:num)’ will not prevent controller Foo and method bar to be called with a non-numeric value if that is a valid route. php like this: Apr 27, 2017 · CodeIgniter routes not working Asked 7 years, 11 months ago Modified 7 years, 2 months ago Viewed 2k times Mar 26, 2021 · hi, thanks for help. Aug 2, 2025 · URI Routing Controllers Controller Filters Auto Routing (Improved) HTTP Messages Request Class IncomingRequest Class Content Negotiation HTTP Method Spoofing RESTful Resource Handling Previous Next May 3, 2016 · @Saty when i try your example i get the some Not Found The requested URL /post/delete/1 was not found on this server. Aug 8, 2020 · CodeIgniter helps you to create a page called “404 error” which helps in getting user engagement without any diversion. 15. Aug 2, 2025 · Controllers and Routing URI Routing Controllers Controller Filters Auto Routing (Improved) HTTP Messages Request Class IncomingRequest Class Content Negotiation HTTP Method Spoofing RESTful Resource Handling Building Responses Working with Databases Modeling Data Managing Databases Library Reference Helpers Testing Command Line Usage Extending Dec 19, 2017 · I have setup a CodeIgniter site but only the default routing seems to be working. I have tested another way. With Defined Route Routing, you can define routes manually. /public should not appear in your URL. Unfortunately, I do not know the exact answer, but it must have been a carry over somewhere from one of the pre-release versions. htaccess, remove or rename the file. While it provides a structured development environment, users often encounter issues such as routing errors, database connection failures, session misconfigurations, and performance bottlenecks. The auto-routing feature in CodeIgniter 3 was exceptionally user-friendly! Due to the discontinuation of PHP 7 support, I am currently evaluating the use of the latest CodeIgniter 4 framework. Jan 2, 2020 · Codeigniter routes works in local server. So change your Mar 25, 2013 · I have a single page web site so all routes should lead to the default router. php I set $route ['404_override']='myerrorcontroller/amethod' and it works for undefined controller class. when I deploy to var/www/html of server, the routes not working as expected. 2 it is working without a problem I cannot change all my Rest API to use /1 in front of the url for put because my Application is already launch. Mar 15, 2023 · CodeIgniter4 - Controller or Method Not Found When Using Routing Groups and Subdirectory in Controllers Asked 2 years ago Modified 2 years ago Viewed 604 times Judging the title, first of all check if your server is running PHP using CGI/FastCGI or not (you could simply check that by phpinfo()). I want to access en/company/login through en/login, so how do I define routes then? Right now routes code looks like this: // URI like '/en/ Mar 20, 2019 · I know I work because I have played with it last year and it works. Nov 30, 2020 · CodeIgniter Forums Using CodeIgniter General Help CodeIgniter 3 routes don't work in HTTPS Feb 24, 2019 · I want to run the codeigniter project which I am currently working on in localhost I setup each and everythng accordingly Feb 27, 2022 · Postman is getting redirected for unknown reason and route not working/ Codeigniter 4 Asked 3 years, 8 months ago Modified 3 years, 8 months ago Viewed 1k times Jul 6, 2021 · What is the issue in above code. But this doesn't work on nginx/apache/xampp any server other than spark/php development server. latestC. Testing Routes: After defining custom routes, make sure to test them in your browser to ensure they work as expected. Wordpress are picking up every url, even the one that should be excluded. Oct 30, 2018 · And a file relating to this controller does not exist and hence the 404 File not found exception is thrown. I have to deploy an old SPA and API to google app engine, so I've split them into 2 services. Oct 21, 2020 · hi, i am developing a website. php in the url. php: // The Auto Routing (Legacy) is very dangerous. But when i uploaded it to windows server,only default controller working. In order to change that open your project at Oct 11, 2015 · i have a problem with my custom routes ! my routes codes works fine in CI3. I mapped my routes, It is working fine without placeholders, but once i add placeholder, it disorganizes my view. I have CodeIgniter setup under: May 1, 2012 · CodeIgniter routing not working Asked 13 years ago Modified 7 years, 1 month ago Viewed 14k times Hello everyone, I'm facing an issue with routing in CodeIgniter 4. Auto-Routing Improved is used when you don't want to register all routes. You'll have to use your main application's routes. Here's the thing: the module's routes. Note the link in the example is changing as they have many branches. php - Route Definitions May 21, 2019 · I'm not sure if you can do a urlencode for the route path. Sep 14, 2023 · This will tell Apache to rewrite all requests to the index. htaccess file, save the file and reload your browser. 1 but after upgrading to CI3. When you use it, use it carefully not to create vulnerabilities. The only way I have been able to make it work is using two routes: routes in codeigniter 4 | codeigniter 4 routes not working | routes in ci4|codeigniter 4 custom routes If this Programming Video Help U : Like 👍 | Comment 💬 | Subscribe : / @yesuus Apr 12, 2023 · What does "still not working" mean? What did you change? What is your project's Document Root? "It redirects to the default page" - do you mean a real redirect, with a 300 or 301 http code, or do you just mean the route shows the index page? Edit your question, add details. Jul 10, 2021 · My CodeIgnater 4 is not recognizing POST routes when I try them in my shared hosting server on Hostinger. You aren't using the pages segment in your URL, therefore the routing for that module never gets Mar 13, 2013 · I've put into production a codeigniter website and I'm getting a strange behaviour that I'm not able to debug. htaccess is works fine and correctly, si Nov 26, 2020 · Controllers under modules should be part of the routing without the need to create a lot of routes for it. php All your controllers must be LOWERCASE for Codeigniter. After changing the routes order is a bit better but still, there are few bugs (?): cannot redirect to checkout/shoppingCart if that route has set the name. php in my URL Only the default page loads No input file specified My app works fine locally but not on the production server The tutorial gives 404 errors everywhere : ( CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support route_to not working with controller::method Oct 4, 2019 · Is this just me or this is not really working? please i am stuck at this problem. Jan 18, 2018 · Routes not working codeigniter Asked 7 years, 10 months ago Modified 1 year, 8 months ago Viewed 14k times Aug 2, 2025 · CodeIgniter has two kinds of routing. Unfortunatly not work. if I turned Auto Route to True. Controllers glue the models and views together. However, I have now created a fresh CI4. I have done all the required settings also but then also its not working. The "trailing slash in url problem" doesn't affect GET request Feb 12, 2018 · I have set up CI project through LAMP stack of which i have exactly the same problem as this guy CodeIgniter routing in Google App Engine I been through the post and no solution is found. Just find it in the main page and prepend the github url with "raw" subdomain. In local host environment: 1. I noticed that the mod. Understanding these challenges and applying best practices ensures a smooth CodeIgniter development experience. 4 Affected module (s) routing Expected behavior, and steps to reproduce if appropriate I'd expect that any controller set under my modules folder to be automatically routed like the ones that are on the app folder. It is easy to create Sep 22, 2022 · $routes->resource Please help me figure out what is the problem. 0. php players is the folder inside /admin and player. I don't know which web server you are using, but most, if not all, can be configured to route those URLs to a static folder and never touch your PHP engine. when I add index. The API is writting in PHP using CodeIgniter, if I write the dis Mar 15, 2024 · CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support Cors policy filter not work Aug 2, 2025 · This section describes the functionality of Auto Routing (Legacy) that is a routing system from CodeIgniter 3. 2. Expected Output should redirect on new typical route Anything Dec 24, 2021 · CodeIgniter4 Installation Method Composer (as dependency to an existing project) Which operating systems have you tested for this bug? Windows Which server did you use? apache Database No response What happened? Redirecting routes not working with typical route Steps to Reproduce . Auto Routing automatically routes HTTP requests based on conventions and execute the corresponding controller methods. Auto-Routing Legacy is a legacy system and dangerous, but if you don't use Controller Filters (including CSRF protection) at all, the risk is low. Jun 3, 2019 · Welcome Guest, Not a member yet? Register Sign In CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support Filter config not working with routes (?) Dec 24, 2021 · The codeigniter routes all call the controller functions fine and load the respective views and any functions on the page that use AJAX to call a controller function all work fine. But in codeigniter you can make it use have the index. Dec 24, 2021 · The codeigniter routes all call the controller functions fine and load the respective views and any functions on the page that use AJAX to call a controller function all work fine. The homepage works however any other URL is routed to this default_controller even though other routes are Nov 17, 2020 · It doesn't show the 404 page for non-existent routes too. I used (:any) then it work. 19. It automatically routes an HTTP request, and executes the corresponding controller method without route definitions. The current url I can access is: http://localhost:8080/project/api/profile_test/ Dec 24, 2021 · CodeIgniter4 Installation Method Composer (as dependency to an existing project) Which operating systems have you tested for this bug? Windows Which server did you use? apache Database No response What happened? Redirecting routes not working with typical route Steps to Reproduce . Only the index route is working, and none of my other controller methods are accessible via URLs. Ok i will Jun 29, 2020 · CodeIgniter Forums CodeIgniter 4 CodeIgniter 4 Support Problem with routes if Controller is in a subfolder Pages (2): 1 2 Next » Sep 21, 2025 · Learn how to create a custom CodeIgniter 404 Page Not Found error page with controller, route, and view setup to improve UX and reduce bounce rate. php in my URL Only the default page loads No input file specified My app works fine locally but not on the production server The tutorial gives 404 errors everywhere : ( Aug 2, 2025 · I have to include index. I'm trying to setup a menu, and using route config to load the proper content but from some reason it's not working. Jan 30, 2015 · I am using CodeIgniter 3 and am having problems getting the router to work in my development environment. If so, change the following in config. Everything after the proceeding / is truncated. php Blog. If i remove return (in this last test) exit work but redirect not work so i show a blank page Jul 17, 2020 · However the route does not work if you do not include the "/ (:any)" in the actual url. pdgp yzgdkc mursux lzo fzch bfely uih rptz gtwgc czko wgmtk feuou gzpz abop jawsztr