Welcome Guest, Not a member yet? Register   Sign In
routing problem
#1

[eluser]Thorpe Obazee[/eluser]
I need to have a url that either accepts

website.com/index.php/ad/2212

website.com/index.php/ad/2212/

or website.com/index.php/ad/2212/free-computers

I already have a routing like this:

Code:
$route['ad/(\d+)/(:any)'] = "ad/view/$1";

this only works for "website.com/index.php/ad/2212/free-computers" but not for "website.com/index.php/ad/2212" or "website.com/index.php/ad/2212/"
#2

[eluser]Thorpe Obazee[/eluser]
My fix right now is this

Code:
$route['ad/(\d+)'] = "ad/view/$1";
$route['ad/(\d+)/(.*)'] = "ad/view/$1";

I have 2 routes. I am thinking if there's a better way to do this using one route.
#3

[eluser]Pascal Kriete[/eluser]
Does this work for you:
Code:
$route['ad/(\d+)/?.*'] = "ad/view/$1";
#4

[eluser]xwero[/eluser]
Routing an url with more than the needed arguments should raise an error otherwise spiders will fetch duplicate content which reduces your chances having a good page ranking.
#5

[eluser]Pascal Kriete[/eluser]
[quote author="xwero" date="1226943272"]Routing an url with more than the needed arguments should raise an error otherwise spiders will fetch duplicate content which reduces your chances having a good page ranking.[/quote]
Unless it isn't publicly accessible (read: backend), but xwero does make a good point here.




Theme © iAndrew 2016 - Forum software by © MyBB