Welcome Guest, Not a member yet? Register   Sign In
strange url changing ...
#11

[eluser]gtech[/eluser]
as far as I am aware everything is routed through the index.php on the root directory of your codeigniter install, thats why it is included in the URL

IF you are using my ../index method in the form open YES the index_page in the config needs to be index.php, YES I put the form opens in the view, and YES index.php will appear in the URL..... its normal :-).

Code:
$config['index_page'] = "index.php";

so its http://<install path>/index.php/<controller>/<function>

You don't have to BUT If your really really want to remove the index.php in the url then this is my take on it (call it an educated guess as I haven't tried it):-

Now I think what people have done in the .htaccess file is when you put the url in the webbrowser without the index.php bit it will tell the webserver to fill in the index.php bit and you don't have to put it in the urls and it wont appear in the url of your browser.

if you [url="http://ellislab.com/forums/viewthread/64739/"](follow this thread)[/url] in his .htaccess you can see the line... RewriteRule ^(.+)$ /index.php/$1 .. I think thats the line that tells the webserver that even though the index.php is not in the url it will still call the index.php page (if you catch my drift?).

Where does the .htaccess file belong? answer I am not sure but at a guess it might be in the root folder of your CI install where the index.php file is.

one final point you should NOT set the index_page in the config by commenting out the index.php you need to set it to an empty string if you want to move the index.php bit.

Code:
$config['index_page'] = "";
#12

[eluser]raimon[/eluser]
ok ...


so, I leave the config:
Code:
$config['index_page'] = "index.php";
If I write:
Code:
http://127.0.0.1/igni/index.php/
I see the login form, it's ok.

but now, the problem (did I say I have a problem??? :lol: ) is that I get this in the form action:
Code:
&lt;form action="index.php/index.php/user/validatelogin" method="post"&gt;
and If I click on the submit button, the url is:
Code:
http://127.0.0.1/igni/index.php/index.php/index.php/user/validatelogin
so, I'm really lost again, now I get three index.php :bug: :bug: :bug: and of course, I get a 404 page ...

I'm going to try from a new framework just in case I change something that I don't remember now ...

thanks again,


raimon
#13

[eluser]gtech[/eluser]
you should be getting
Code:
&lt;form action="../index.php/user/validatelogin" method="post"&gt;

then it will work..

hopfully Smile
#14

[eluser]raimon[/eluser]
[quote author="gtech" date="1195614285"]you should be getting
Code:
&lt;form action="../index.php/user/validatelogin" method="post"&gt;

then it will work..

hopfully Smile[/quote]

yes, I know ... :long:
#15

[eluser]gtech[/eluser]
LOL what does your form open look like then?
Code:
&lt;?=form_open('../index.php/user/validatelogin','','');?&gt;

if that dont work try
Code:
&lt;?=form_open('../../index.php/user/validatelogin','','');?&gt;
#16

[eluser]raimon[/eluser]
well, with a new framework, the problem is the same ...

simply copy this in a view and load it ...

Code:
&lt;?= form_open('user/validatelogin/'); ?&gt;

    <p><label for="username">Username:</label><br />
    &lt;input type="text" name="username" id="username" /&gt;</p>

    <p><label for="password">Password:</label><br />
    &lt;input type="password" name="password" id="password" /&gt;</p>

    <p>&lt;input type="submit" value="Login" /&gt;</p>

&lt;?= form_close(); ?&gt;


and the form action is ...
Code:
&lt;form action="index.php/user/validatelogin" method="post"&gt;

so, this works only when the url is:
Code:
http://127.0.0.1/igni/

after the first submit, the url changes into:
Code:
http://127.0.0.1/igni/index.php/user/validatelogin

well, this is beacuse this controller doesn't exist in this new framework, but ...

if the url is:
Code:
http://127.0.0.1/igni/index.php/

the url is ...
Code:
http://127.0.0.1/igni/index.php/index.php/user/validatelogin

:ahhh: :ahhh: :ahhh: :ahhh: :ahhh: :ahhh: :ahhh:
:cheese: :cheese: :cheese: :cheese: :cheese: :cheese: :cheese:
:-)
#17

[eluser]gtech[/eluser]
sorry I get your problem ignore this reply I was talking rubbish
#18

[eluser]gtech[/eluser]
ok I getcha I think I had my wires crossed, and not understanding you problem... easy fix is to create a login function in the controller. Then in the index function on the controller put a redirect to the login function.. Im really sorry for not undersatnding your problem straight away.

It should work but there may be a nicer solution...

one thing to check out also is the validation helper in the CI documentation as this is really usefull for form parsing.
#19

[eluser]raimon[/eluser]
[quote author="gtech" date="1195617142"]sorry I get your problem ignore this reply I was talking rubbish[/quote]

so, you're getting the same error as me ???? :bug: :-)
#20

[eluser]gtech[/eluser]
No I just undrstand why you are getting the error, as you are loading the form in the index page of the default controller and so the two different urls can differ, and thats why you are having problems with the form open function..



you can just open a form in the normal way in HTML and put the full path in and not use form_open function.. or do what I put in post above and redirect to a differnet function




Theme © iAndrew 2016 - Forum software by © MyBB