Welcome Guest, Not a member yet? Register   Sign In
URL Rewriting
#1

[eluser]Naeem084[/eluser]
hi..

need some help in URL rewriting via routs.php.
actually i have done some static URLs successfully but i m not able to rewrite dynamic URLs like.. http://localhost/travel/client/destinati...x/index/48 where destinations is my controller.
#2

[eluser]Thorpe Obazee[/eluser]
Perhaps you can elaborate what your problem is? Or what you have already done?
#3

[eluser]Naeem084[/eluser]
that is what i have done in my routs.php

$route['client-feedbacks'] = "feedbacks/index";
$route['more-destinations'] = "moredest/index";

but these were static url now i want to rewrite my dynamic url
which can have numeric values after functions
like.... "moredest/index/2"
#4

[eluser]rogierb[/eluser]
The user guide might come in handy. Read it, especially the part where routing is explained.
#5

[eluser]praveens[/eluser]
Check this

http://ellislab.com/codeigniter/user-gui...uting.html
#6

[eluser]Naeem084[/eluser]
i check out that link but i didn't find any help or might not get that...
i want to do a very simple job as i have url like this bellow....

http://ans/travel/client/destinations/index/0/651

and now i want to rewrite it as bellow...

http://ans/travel/india-transfers

and i m using routs.php file there i already change some static urls but that given one is dynamic one and the last number "651" can be change and with that in required url "india-transfers" will be change as well

urgent please help
#7

[eluser]Zeeshan Rasool[/eluser]
Naeem84 , try this way, i thik you are talking about this thing

Code:
$route['(.*)/yourfunction/([1-3]+)/([0-9]+)'] = 'site/yourfunction/$2/$3';

In above code line .* is the first dynamic part of url next is your function and in the last two param are defined.
You can use make levels in url but when you get this in routes then keep track of positioning for url.

Good luck !
#8

[eluser]Naeem084[/eluser]
hello zeeshan.... how are you?? im also from lohore...
thanks for your kind help but really i didn't get ur code...
could you please arrange it about the code i have given in last reply??? so that i can understand it better.... its really urgent please
#9

[eluser]Zeeshan Rasool[/eluser]
ap chahty ho k main seedha seedha code likh dun :-)
ok check it now ;-)
Quote:
Code:
http://ans/travel/client/destinations/index/0/651

and now i want to rewrite it as bellow…

http://ans/travel/india-transfers
ok if i understand your query then try like this.

Code:
http://ans/travel/india-transfers

$route['http://ans/travel/client/destinations/index/([0-9]+)/([0-9]+)'] = 'http://ans/travel/client/destinations/$1';
#10

[eluser]Naeem084[/eluser]
hi zeeshan...
thanks again... i got ur way of rewriting but there is still a confusion...
and that is i write that url in this way that the last segment will be a name of a destination and there should not be any number at the last..

like here

Code:
$route['http://ans/travel/client/destinations/index/([0-9]+)/([0-9]+)'] = 'http://ans/travel/client/destinations/$1';

'http://ans/travel/client/destinations/$1';

in this line there will be a destinations and then '/' and then a number but what i want is..
Code:
'http://ans/travel/client/countryname-transfers';
hope u can solve this.... thanks in advance




Theme © iAndrew 2016 - Forum software by © MyBB