CodeIgniter vs. Friendly URLs

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
Arocity
Forum Newbie
Posts: 15
Joined: Tue Jun 10, 2008 8:30 am
Location: Washington, DC

CodeIgniter vs. Friendly URLs

Post 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.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: CodeIgniter vs. Friendly URLs

Post 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 :)
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: CodeIgniter vs. Friendly URLs

Post by Christopher »

Perhaps you should have a little humbler signature -- unless you actually know everything. ;)

http://codeigniter.com/user_guide/general/routing.html
(#10850)
User avatar
Arocity
Forum Newbie
Posts: 15
Joined: Tue Jun 10, 2008 8:30 am
Location: Washington, DC

Re: CodeIgniter vs. Friendly URLs

Post 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...
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: CodeIgniter vs. Friendly URLs

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: CodeIgniter vs. Friendly URLs

Post 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;
}
(#10850)
Post Reply