Welcome Guest, Not a member yet? Register   Sign In
Rewriting URLs without invoking a different controller
#1

[eluser]mattpointblank[/eluser]
Hi everyone, I'm new to CI.

I run a news site. Our article URLs look like this:

site.com/news/sport/ronaldo-signs-with-milan.html
site.com/features/interview/bob-dylan.html
site.com/news/comment/i-hate-capitalism.html

In my current system, I use .htaccess to rewrite all URLs to point to article.php?section=news&category=sport&story=ronaldo-signs-with-milan - a little lengthy, but it works. I realise that if I was to apply these URLs to CodeIgniter, it would look for a 'news' or 'features' controller, rather than routing all of these requests through one 'article' controller.

I looked briefly over the URI class, but I'm not certain if it's meant for this kind of thing. Can anyone give me a quick example (if it's possible) of how to achieve these kind of URLs while maintaining a normal CI structure?

If it helps, I'm completely happy to include ID numbers in links (eg site.com/news/sport/123/ronaldo-signs-with-milan.html) if that makes it easier.

Matt


Messages In This Thread
Rewriting URLs without invoking a different controller - by El Forum - 06-24-2009, 03:09 AM
Rewriting URLs without invoking a different controller - by El Forum - 06-24-2009, 05:41 AM
Rewriting URLs without invoking a different controller - by El Forum - 06-25-2009, 08:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB