![]() |
why routing not work - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: why routing not work (/showthread.php?tid=80965) |
why routing not work - yoshi - 01-08-2022 hi there. current theme is school. PHP Code: /* (Picture1: I can't paste a image.) `http://localhost:8080/school/` not works. but, for example ... change to `schoolx` PHP Code: /* (Picture2: I can't paste a image.) `http://localhost:8080/schoolx/` it works. why routing not work?? infomation: controller name is `School.php` RE: why routing not work - kenjis - 01-09-2022 What do you mean by not works? RE: why routing not work - yoshi - 01-09-2022 (01-09-2022, 03:01 AM)kenjis Wrote: What do you mean by not works? thank you kenjis. here, following picture for error. https://drive.google.com/file/d/1Tl92IK_z-z-4AwFZnQ_rylFsYAHhWDfs/view?usp=sharing Quote:[Sun Jan 9 20:10:28 2022] PHP 8.1.1 Development Server (http://localhost:8080) started Why can't I paste images on this bulletin board? RE: why routing not work - iRedds - 01-09-2022 Do you have a school directory in public? RE: why routing not work - yoshi - 01-09-2022 (01-09-2022, 09:20 AM)iRedds Wrote: Do you have a school directory in public? iRedds, thank you for your reply. Yes, there is a "school" directory. Look at the next image. https://drive.google.com/file/d/19Jxf0AP57WxHwqAX1-ft04kLgvMyL0kC/view?usp=sharing RE: why routing not work - iRedds - 01-09-2022 Well, actually this is the problem. First, the web server looks for paths in the DOCUMENT_ROOT (public directory) and if it doesn’t find it, then it passes control to php. If you have a /public/school directory, then when you go to the address http://domain/school, the web server will try to read it. So in your case, I would recommend changing the paths. /public/assets/school /public/assets/home RE: why routing not work - yoshi - 01-09-2022 (01-09-2022, 07:03 PM)iRedds Wrote: Well, actually this is the problem. Thank you iRedds. I solved it by creating the 'assets' folder. Is it "codeigniter" to study this basic mechanism? Or is it "php"? I want to know why such a routing accident happened RE: why routing not work - iRedds - 01-09-2022 The web server first of all looks for the directory or file specified in the URL. By default, if a file or directory is not found, the server generates a 404 error. 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. Absolutely all frameworks work on this principle. RE: why routing not work - yoshi - 01-10-2022 (01-09-2022, 10:54 PM)iRedds Wrote: The web server first of all looks for the directory or file specified in the URL. thanks, I voted for you. |