Url routing errors in php in codeigniter

时光怂恿深爱的人放手 提交于 2020-01-16 19:40:40

问题


My login form on front page is displayed, but when it posts to other pages, the post does not happen. THe problem is that the url is like: http://sitename/users/action which is a 404 not found url. But when i hard code the path to controller, (that is, stop using base_url + "/users/action" and use base_url + "/system/application/controllers/users/action") it starts working. How can i fix this problem?


回答1:


Are you using .htaccess to hide index.php? If so, you need to take that into account with your routing. If not, you need to include it. e.g. if you're not hiding it, try:

base_url+"/index.php/users/action"




回答2:


You can also try your config/config.php folder and fix your $config['base_url']...hope that helps.




回答3:


i had the .htaccess file in the wrong folder, inside the system/application/config/ folder, instead of the root folder. after i pasted the file in the root folder, the problem was solved.



来源:https://stackoverflow.com/questions/3239190/url-routing-errors-in-php-in-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!