CodeIgniter Forums
how to use routes with url having querystring - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: how to use routes with url having querystring (/showthread.php?tid=54267)



how to use routes with url having querystring - El Forum - 08-31-2012

[eluser]Tejas D[/eluser]
My url is - http://localhost/demo/varstreet/index.php/site/loadnewview?partid=113&isvarstreet=0&productid=111&resellerid=4652


I want to use routes feature for the above url.
where - site is controller and
loadnewview is method


How to construct route for above url.

$route['Productview/(:any)'] = 'site/loadnewview/';

But it doesnot work.

please someone help me on this.


how to use routes with url having querystring - El Forum - 08-31-2012

[eluser]noTime[/eluser]
Code:
$route['Productview/(:any)'] = 'site/loadnewview/$1';



how to use routes with url having querystring - El Forum - 08-31-2012

[eluser]Tejas D[/eluser]
[quote author="noTime" date="1346399826"]
Code:
$route['Productview/(:any)'] = 'site/loadnewview/$1';
[/quote]


Thanks,

I tried that but still it doesnot work.

url has querstring and not segments.

need example for writing routes for url having query string

please help me...


how to use routes with url having querystring - El Forum - 08-31-2012

[eluser]noTime[/eluser]
It seems that (:any) has to be "something" excluding GET parameters. Try:

Code:
$route['Productvie(:any)'] = 'site/loadnewview/$1';

So $1 will be "w", but at least you prevent losing GET params.