Welcome Guest, Not a member yet? Register   Sign In
CI file structure
#1

[eluser]Tommy Liu[/eluser]
Dear all,
I am newbie of CI. I have one question of CI file structure, please see as below:

If I try URL: http://localhost/index.php, it shows controllers/abc.php file which I setup all the files correctly.

If I try URL: http://localhost/aboutus.php, I want to shows controllers/xyz.php file. What can I do? Actually, is it possible to do that? Thank you.
#2

[eluser]pistolPete[/eluser]
Read the user guide: http://ellislab.com/codeigniter/user-gui...uting.html
#3

[eluser]Tommy Liu[/eluser]
[quote author="pistolPete" date="1255735398"]Read the user guide: http://ellislab.com/codeigniter/user-gui...uting.html[/quote]

Thank you for your help and reply. I try to read it before I post my question. But I still do not understand how to do it.

[routes.php]
$route['aboutus.php'] = "xyz";

But I need to type URL: http://localhost/index.php/aboutus.php to get the result. Would you mind to post the sample to me? Thank you very much.
#4

[eluser]markup2go[/eluser]
You need to enable mod_rewrite and edit your config.php and set $config['index_page'] = "";

See the URL Helper page of the CI User Guide
#5

[eluser]Tommy Liu[/eluser]
[quote author="markup2go" date="1255736821"]You need to enable mod_rewrite and edit your config.php and set $config['index_page'] = "";

See the URL Helper page of the CI User Guide[/quote]

Thank you for your reply. I read it already. But it does not show how to setup or config for typing URL: http://localhost/aboutus.php route to controllers/xyz.php. Thank you.
#6

[eluser]markup2go[/eluser]
Code:
$route['aboutus.php'] = "xyz";
should work then.

Please paste your .htaccess and make sure you have xyz.php in system/application/controllers and that has an index() function.

Or tell us what it the current behavior when you type that url in your browser.
#7

[eluser]Dan Horrigan[/eluser]
Actually it does. You said you have it working as http://localhost/index.php/aboutus.php and the CodeIgniter URLs page has a section called "Removing the index.php file". Read that section. If you need more info on how this works do a google search for mod_rewrite and .htaccess.

Don't forget this either when removing the index.php part:
[quote author="markup2go" date="1255736821"]edit your config.php and set $config['index_page'] = "";
[/quote]

Doing both of these steps (the .htaccess and the config file edit) will allow you to go to http://localhost/aboutus.php

Dan
#8

[eluser]Tommy Liu[/eluser]
[quote author="Dan Horrigan" date="1255737910"]Actually it does. You said you have it working as http://localhost/index.php/aboutus.php and the CodeIgniter URLs page has a section called "Removing the index.php file". Read that section. If you need more info on how this works do a google search for mod_rewrite and .htaccess.

Don't forget this either when removing the index.php part:
[quote author="markup2go" date="1255736821"]edit your config.php and set $config['index_page'] = "";
[/quote]

Doing both of these steps (the .htaccess and the config file edit) will allow you to go to http://localhost/aboutus.php

Dan[/quote]

Thank you. I can get the result successfully!!!
#9

[eluser]Tommy Liu[/eluser]
I have one more question that is I want to type URL: http:\\localhost\user_guide\, but it cannot show the CI user guide homepage. What can I do? Thank you.
#10

[eluser]Unknown[/eluser]
test




Theme © iAndrew 2016 - Forum software by © MyBB