URI Routing for URLs with dashes (-) |
[eluser]ehicks727[/eluser]
I'm converting an existing project to CI and I'm stuck on an important issue. The existing project has urls with dashes, and this has to stay this way for SEO purposes. I searched the forum and didn't find an answer that solved my problem. Here's what I've done so far, maybe someone will notice right away what I'm doing wrong, hopefully? My goal is to route to a url like this: http://www.example.com/business-directory.php I created a controller business_directory.php with the following code so far. Code: class Business_directory extends Controller { It works if I don't use routing and just go to http://www.example.com/business_directory I see 'Hello World!" I added this to my routes.php: Code: $route['business-directory'] = "business_directory"; I'm getting 404s when I type in http://www.example.com/business-directory Ideally, I'd like to add Code: $config['url_suffix'] = ".php"; I hope that makes sense, and I GREATLY appreciate any help that anyone can give me. thanks, Eric
[eluser]ehicks727[/eluser]
Ok, I'm retarded. In the Controllers guide, I read that this default constructor works in PHP5, so I used it. Code: function __construct() { Then I noticed that routing stopped working completely. So I changed my default constructor to this again Code: function Business_directory() { and now everything works great. Why does this Code: __construct() |
Welcome Guest, Not a member yet? Register Sign In |