Welcome Guest, Not a member yet? Register   Sign In
URI Routing for URLs with dashes (-)
#1

[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 {

    function __construct() {
        parent::Controller();    
    }
    
    function index() {
        echo 'Hello World!';
    }
    
}

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";
to my config.php file so that I can type in http://www.example.com/business-directory.php

I hope that makes sense, and I GREATLY appreciate any help that anyone can give me.

thanks,
Eric


Messages In This Thread
URI Routing for URLs with dashes (-) - by El Forum - 03-17-2008, 11:31 AM
URI Routing for URLs with dashes (-) - by El Forum - 03-17-2008, 05:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB