Welcome Guest, Not a member yet? Register   Sign In
url in form_open()
#11

[eluser]vickatg[/eluser]
from this i note that when posting the form, the url directing it to the controller is

http://localhost/myproject/login/process and not

http://localhost/myproject/index.php/login/process how do i arrive at this then?
#12

[eluser]toopay[/eluser]
As i stated above, your problems is about removing index.php fom your url :-S (i hate to have a repetitive explanation as much as i hate to have a repetitive code in my app)

First thing you must achieve, is how to make 'http://localhost/myproject/login/process' brought you to the right controller, by removing 'index.php' from your url.

HOW? htaccess! The first .htaccess i gave, failed (i believe because you run in Ubuntu, that htaccess works fine in Windows, Mac and even at some Linux server, outside Ubuntu maybe). Ok dude, let's try some variation..
1.
Code:
RewriteEngine On
RewriteBase /myproject/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) myproject/index.php?/$1
2.
Code:
RewriteEngine On
RewriteBase /myproject/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.* /myproject/index.php/$1
3.
Code:
RewriteEngine On
RewriteBase /myproject/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.* myproject/index.php/$1
#13

[eluser]vickatg[/eluser]
toopay thanks, though no progress so far. am using ubuntu 10.10, i guess there should be other configuration to support the settings. i have searched throughout the forum concerning the issue. and configuring it in linux ubuntu seems to be a problem. probably i need someone who has configured it in linux to brief me. i am stack at the moment
#14

[eluser]toopay[/eluser]
Are you done tried each variation above? Do it separately, with clearing all your browser cache or if necessary restarting your LAMP server each time before you test the variation above!
#15

[eluser]toopay[/eluser]
If you want the quick solution, to your problems, that would be like this
Code:
<?php echo form_open('index.php/login/process/some_function',  array('class' => 'normal_form') ); ?>
With above code, you dont need to remove index.php from your url.
#16

[eluser]danmontgomery[/eluser]
is base_url correctly defined in config/config.php?
#17

[eluser]toopay[/eluser]
@Noctrum

If you follow this thread carefully, his problems is at htaccess configuration. If, he didn't include index.php on url, his server will response with 404 from Apache, not 404 CI! Its must be done first, before we talk about base_url(i believe even we set base_url to blank ('') its will be fine, IF the htaccess works as is should).
#18

[eluser]danmontgomery[/eluser]
[quote author="vickatg" date="1303217276"]my validation is inside the index function, but whenever i check the directed url on the address bar
it looks http://localhost/myproject/login/process while my controller is in

http://localhost/myproject/application/c...in/process are my configuration wrong?[/quote]

Sounds to me like htaccess is working fine, it's the form_open() which is generating the wrong url... That url is based on the value of base_url in config.php

If CI is installed in myproject/, and that isn't declared in base_url, form_open() will generate /controller/login/process, not /myproject/controller/login/process, which won't work regardless of htaccess
#19

[eluser]toopay[/eluser]
[quote author="noctrum" date="1303325819"]Sounds to me like htaccess is working fine[/quote]

Then, why apache tell him 404 error when he access 'http://localhost/myproject/somecontroller' ? The url generated by form helper is correct, its pointed to 'http://localhost/myproject/somecontroller', but since the htaccess not working, he must access 'http://localhost/index.php/myproject/somecontroller' to get what he want. Thats why i tell him that his problems is mod_rewrite stuff, but... if he want quick solution, i suggest him to include 'index.php' inside form_open() so it will works.

[quote author="noctrum" date="1303325819"]If CI is installed in myproject/, and that isn't declared in base_url, form_open() will generate /controller/login/process, not /myproject/controller/login/process, which won't work regardless of htaccess[/quote]
Noctrum, i believe you pointed to different CI version. At CI under version 2.x, yes, but above that version, as i stated above, even we set base_url to '', it will working fine!
Just in case you forgot this comment on config.php
Code:
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|    http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url']    = '';
#20

[eluser]vickatg[/eluser]
thanks for the conversation, i have opted to use

<?php echo form_open('index.php/login/process/some_function', array('class' => 'normal_form') ); ?>

in linux (ubuntu).

though the above .htaccess works fine in windows.
if i get the solution on how to remove index.php in linux (ubuntu) i will share it here.




Theme © iAndrew 2016 - Forum software by © MyBB