![]() |
space in url - 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: space in url (/showthread.php?tid=4944) Pages:
1
2
|
space in url - El Forum - 12-26-2007 [eluser]JOKERz[/eluser] i have url like this : http://localhost/ci/controller/function/keyword/sort/order/page_number when the keyword contain space like this: http://localhost/ci/news/index/key%20word/name/asc/2 why it return page not found? space in url - El Forum - 12-26-2007 [eluser]xwero[/eluser] if you are searching for 'key word' in your controller you have to use urldecode Code: if(urldecode($this->uri->segment(3)) == 'key word'){ // do something } space in url - El Forum - 12-26-2007 [eluser]JOKERz[/eluser] what if my keyword contain 3 word with space at all?? ex: $keyword = "this is keyword" so it should be: http://localhost/ci/news/index/this%20is%20keyword/name/asc/2 space in url - El Forum - 12-26-2007 [eluser]xwero[/eluser] the function urldecode will change all %20s to spaces so it doesn't matter how many spaces are in the keyword. space in url - El Forum - 12-26-2007 [eluser]JOKERz[/eluser] [quote author="xwero" date="1198691262"]the function urldecode will change all %20s to spaces so it doesn't matter how many spaces are in the keyword.[/quote] still return : 404 Page Not Found The page you requested was not found. i try to use str_replace(' ','_',$keywords) it works normal but when i use str_replace(' ','+',$keywords) it return The URI you submitted has disallowed characters. space in url - El Forum - 12-26-2007 [eluser]xwero[/eluser] try to use the url_title function from the url helper Code: url_title($keywords) space in url - El Forum - 12-26-2007 [eluser]Sarfaraz Momin[/eluser] You have to modify your config.php file in the application/config folder Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-+'; Good Day !!! space in url - El Forum - 12-26-2007 [eluser]JOKERz[/eluser] ok, i will try all of your suggestion. but back to my case above. why when theres space or %20 in the url, ci sez page cannot be found? is something wrong with my script? space in url - El Forum - 12-26-2007 [eluser]JOKERz[/eluser] [quote author="Sarfaraz Momin" date="1198695701"]You have to modify your config.php file in the application/config folder Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-+'; Good Day !!![/quote] i got this Code: A PHP Error was encountered space in url - El Forum - 12-26-2007 [eluser]xwero[/eluser] permitted_uri_chars regex It's almost the same as Sarfaraz maybe the + at the end causes the error. |