Welcome Guest, Not a member yet? Register   Sign In
Best way to remove "content" from my url
#1

[eluser]tommo.wilson[/eluser]
Hi there,

I have a CMS which I have built and currently the url's for a page look like this...

http://www.example.com/content/example-page
http://www.example.com/content/test-page

What I would like is to have the pages look like this instead...

http://www.example.com/example-page
http://www.example.com/test-page

How would I go about doing that?

Cheers
Tom
#2

[eluser]DBPolito[/eluser]
I don't know if it is the best way, but some time i used this in config/routes.php:

$route['^((?!controller_names|controller_names)\S*)'] = "controller/function/$1";

Replace controller_names by your controllers that you don't want redirect.

Someone have another way?

Regards
#3

[eluser]portgaz[/eluser]
Hi I think you can use this one:
Code:
$route['content/(.*)'] = '$1';
Visit this USERGUIDE URI Routing
#4

[eluser]tommo.wilson[/eluser]
Hi DBPolito

That works perfectly...not sure why because I'm not that hot at regular expressions.

But thanks all the same.
Tom




Theme © iAndrew 2016 - Forum software by © MyBB