Cruising2hell
Cruising2hell

Reputation: 133

Need a controller named "directory" in codeigniter

I need my controller to be name "directory" so I can have urls for my business directory page like "mysite.com/directory". But the problem is that "directory" is a predefined php class, so I cannot declare it again. It gives error

Fatal error: Cannot redeclare class Directory in C:\wamp\www\Logistica\system\application\controllers\directory.php on line 8

Is there a way I can rename my class and controller to something else and still have the "directory" in URL ?

Upvotes: 1

Views: 672

Answers (2)

sibiraj
sibiraj

Reputation: 55

you can use .htaccess to change the URL. that means your name is something other than directory then you can use Rewrite rules to change the name in URL

reference: htaccess in codeigniter

Upvotes: 1

Dolbz
Dolbz

Reputation: 2106

Take a look at CodeIgniter routing

In your case you'll want a route like:

$route['directory'] = "DirectoryImplementationClass";

Upvotes: 6

Related Questions