Welcome Guest, Not a member yet? Register   Sign In
Masking either class/method in URI for shorter, more SEF URLs
#1

[eluser]cgee[/eluser]
Hi. Im building a little store site and am looking to make the urls as short and search engine friendly as possible.

I've hidden the index.php file, but am hoping to make the url even shorter by masking either the class or method.

Currently things look like this:

site.com/class/method/id

...as in:
site.com/category/detail/2

I'd like to get things to look this:

site.com/category/id

where category is a class and the next segment is an id, not a method.

Is this possible?

Alternately, can I run the site off of one class and then mask it in the uri?

Thanks for your help.
#2

[eluser]Michael Wales[/eluser]
In routes.php:

Code:
$route['category/(\d+)'] = 'category/details/$1';

Required reading
#3

[eluser]cgee[/eluser]
Thank you.
#4

[eluser]coldautumn[/eluser]
Kindly need a more modified solution

You have given a way for SE url's

Quote:
In routes.php:

$route['category/(\d+)'] = 'category/details/$1';

But what if , there are two variables i-e $1 & $2 and the required url should only have $2 in preceding.

For example : Got a url " site-name/directory/list/$1/$2 "
should be : "site-name/list/$2"

I have added in route.php

$route['list/$2']="directory/list/$1/$2"; nothing effected.
and only adding routing variable like above ,will generate the result or do I have to add same rule to htaccess file?


Thank you.




Theme © iAndrew 2016 - Forum software by © MyBB