简体   繁体   中英

PHP CodeIgniter URL navigation issue

I am new to CodeIgniter and also have average PHP knowledge. Just started learning CodeIgniter last week and having a basic problem which i can't overcome. my development environment is (OS,PHPStorm,MAMP,APACHE). CI project root is http://localhost:63342/CodeIgniter/ and this address loads my 'default_controller' (login.php in Controllers folder). this controller redirect me to my view "$this->load->view('login_view');". in my view i have a form with this line: which supposed to take me to my form.php in Controller upon the form being submitted but it does not! when i submit i am taken to a url : http://127.0.0.1/CodeIgniter/form with error message "connection attempt to 127.0.0.1 was rejected.".

Also when i try to type a url (ie BASE_URL()./index.php/form) or amy other URL in fact, i get errors too. i was under impression that navigating through pages in CI is as simple as typing the name of the file and the method in it in my Controller folder. what am i missing here? any attempt to navigation through URL i get "404 Not Found" error. i am sure i am missing something very simple here but i can't figure out what. i have read the documentations and search the web and no answer is found. i have changed the .htdaccess in root, tried the enable mode in Apache, done all the necessary changes in Config.php , routes.php etc. i would appreciated it if you can tell what am i doing wrong here. i wasn't expecting getting started with CI to be this hard :s

cheers

It seems you "loose" the port (63342) when you redirect. What is the action of your form? If this is an url like " http://localhost/CodeIgniter/form ", you should add the port : http://localhost:63342/CodeIgniter/form

You can output set your login form's action by using the URL helper.

site_url('form')

http://www.codeigniter.com/user_guide/helpers/url_helper.html?highlight=site_url#site_url

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM