SEO Friendly URLS, Using Hyphens not Underscores |
[eluser]mteejay[/eluser]
Hi, I have just started out using the CI framework in the last couple of days and am considering using it as a basis to develop applications and websites for my clients. I have no problem understanding how to use the framework itself as it is fairly intuitive. I understand about the the frameworks ability to use use hyphens in the uri segments, I realise that these are disallowed characters in the url but there are workarounds that I have seen on this forum including http://ellislab.com/forums/viewthread/124396/#644012 (this actually has a couple of solutions from using a .htaccess file to using a MY_Routes.php file and hooks). The problem is I just can't get it to work on my sample project. I am setting up a file in the /controllers/ with the naming convention this_is_my_file.php and naming the controller something like class this_is_my_file extends CI_CONTROLLER blah blah blah, but whenever I type in the url http://www.sampleproject.com/this-is-my-file it cannot find the controller. I was under the impression that MY_Router.php took care of this for me? I will add some code in below for a sample page on say...banking_finance.php Code: <?php I feel as though I am missing something obvious, the custom MY_Router.php should be extended automatically as it is (I got it from these forums): Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Please help a newbie!
[eluser]Akinzekeel[/eluser]
Take a look at URI Routing in the user guide. Here's an example: Code: $route["banking-finance"] = "banking_finance";
|
Welcome Guest, Not a member yet? Register Sign In |