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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.