Welcome Guest, Not a member yet? Register   Sign In
Anyone know how to shorter the number of strings after the url by routing
#1

[eluser]Unknown[/eluser]
Hi.

I want to change the following url

example.com/board/view/$board_id
into
example.com/view/$board_id, or
example.com/$board_id

The thing is that I cannot change the three string urls into two or one string urls.

For example,
$route['view/:any']="board/view/$1";
is not working.


Whatever I put in, unless the number of strings after the url is same to
before the change, the routing is not working properly.

Does anyone know why? and is there any ways that I can change it from route.php?
#2

[eluser]keevitaja[/eluser]
Code:
$route['board/view/:any'] = "view/$1";
#3

[eluser]Unknown[/eluser]
[quote author="keevitaja" date="1348670957"]
Code:
$route['board/view/:any'] = "view/$1";
[/quote]

I don't know why mine is not working.

I initially tried what you stated, but it did not work.

very confused.

#4

[eluser]CroNiX[/eluser]
If you are going to use :any to capture a variable and pass it to the function, it has to be (:any) with the (). See the userguide for routing.




Theme © iAndrew 2016 - Forum software by © MyBB