Page 1 of 1

CodeIgniter vs. Friendly URLs

Posted: Mon Jul 14, 2008 2:09 pm
by Arocity
I'm getting ready to start development on a site for local businesses. Clearly, I want the clients to have a "user-friendly" URL such as "mystate.example.com/mybusiness". However, I'm leaning toward using the MVC design w/ CodeIgniter for the design. I cannot for the life of me see a way to use the framework AND have a user-friendly URL w/out going to the pains of setting up redirects to have "mystate.example.com/mybusiness" point to "www.example.com/class/function/ID" for every site I create. Anyone figured out a way around this or have any ideas? This has been one of my biggest gripes w/ using frameworks rather than banging it out from scratch.

Re: CodeIgniter vs. Friendly URLs

Posted: Mon Jul 14, 2008 2:30 pm
by alex.barylski
Well CI likely has an option switch somewhere in it's config files that when enabled will generate links which are SEO friendly.

That is, instead of:

Code: Select all

index.php?page=about-us
It would generate links like:

Code: Select all

about-us.php
You would then enabled the .htaccess file and that is about all that would need to be done. In your own scripts ot templates you would either need to:

1. Generate SEO friendly links
2. Check the API and see if there is an _isSeoRequired() and generate SEO friendly links or dynamic links depending on the setting.

The latter I have no idea if it's possible but it would make sense to me with the limited knowledge I have of CodeIgnitor...

Cheers :)

Re: CodeIgniter vs. Friendly URLs

Posted: Mon Jul 14, 2008 2:31 pm
by Christopher
Perhaps you should have a little humbler signature -- unless you actually know everything. ;)

http://codeigniter.com/user_guide/general/routing.html

Re: CodeIgniter vs. Friendly URLs

Posted: Mon Jul 14, 2008 2:44 pm
by Arocity
Thanks Hockey.
Perhaps you should have a little humbler signature -- unless you actually know everything. ;)
It was supposed to be a little cheesy PHP humor, but I guess of the Gods of PHP disapprove. I didn't know you had to know everything to not be considered an idiot. Anyway, thanks for the link. Looks like what I need...

Re: CodeIgniter vs. Friendly URLs

Posted: Mon Jul 14, 2008 3:49 pm
by alex.barylski
It was supposed to be a little cheesy PHP humor, but I guess of the Gods of PHP disapprove
I found it cheesy if that helps any? :P

Re: CodeIgniter vs. Friendly URLs

Posted: Mon Jul 14, 2008 3:50 pm
by Christopher
Arocity wrote:I didn't know you had to know everything to not be considered an idiot.
No ... but the spirit of these forums is that we are all ignorant and even foolish in some areas ... which is why we ask questions and share answers ... ;)

Perhaps:

Code: Select all

while($people->haveQuestions()){
    $me->answer($person->question());
    ++$karma;
}