CI 묻고 답하기

제목 URL 라우터 질문
글쓴이 겐자이 작성시각 2014/07/25 15:12:02
댓글 : 3 추천 : 0 스크랩 : 0 조회수 : 11979   RSS
URL에 쩜->(.) 을 넣었을때 base_url의 문제점이있습니다.
 
검색게시판을 만드는 중 버그를 발견했습니다.
"localhost/board/lists/q/검색어/페이지네이션번호" 이렇게 사용하고있는데
검색부분에서  검색어마지막에쩜이 찍히면 경로를 잡을 수 없습니다.
하지만 영어에서 쩜을 붙이면 되긴되더군요..
EX) localhost/index.php/board/lists/q/검색어./q/1 ->페이지에러
      localhost/index.php/board/lists/q/검색어/q/1 ->정상
      localhost/index.php/board/lists/q/sear./q/1 -> 정상


코드이그나이트 공식홈페이지도 "q/검색어/ " 이렇게 되어있지만 검색어 마지막에 쩜을 넣어도 제대로 동작을 하고있습니다만..
환경설정의 문제로 고쳐질 수 있는 것인가요? 아니면 검색어를 인코딩을하여 주고받아야되는건가요..

ps) 코어단을보니 $_SERVER[SCRIPT_NAME]과 현재URL을 비교하여 문자열을 자른뒤 파싱을 하는것같은데..
쩜을 붙이니 경로가  쩜 앞까지 인식을 하더군요...
localhost/index.php/lists/3  -> $_SERVER[SCRIPT_NAME]  = localhost/index.php
localhost/index.php/lists/q/질문./2 -> $_SERVER[SCRIPT_NAME] = localhost/index.php/lists/q

환경설정으로 고치는 방법은 없나요?
 
 다음글 안녕하세요 초보입니다! $this -> db -&... (3)
 이전글 csrf_cookie 관련해서 문의드립니다. (2)

댓글

변종원(웅파) / 2014/07/25 15:22:38 / 추천 0
포럼 주소는 index.php를 없애고 사용중입니다.

아래는 포럼 config.php중 uri관련 셋팅입니다.

$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://" . $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'            Default - auto detects
| 'PATH_INFO'        Uses the PATH_INFO
| 'QUERY_STRING'    Uses the QUERY_STRING
| 'REQUEST_URI'        Uses the REQUEST_URI
| 'ORIG_PATH_INFO'    Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol']    = 'AUTO';
겐자이 / 2014/07/25 15:49:13 / 추천 0
인덱스를 없애고 사용하는 이유는 무엇인가요
변종원(웅파) / 2014/07/25 16:45:20 / 추천 0
굳이 무의미하게 반복되는 주소를 9자나 더 치는 것과 안치는 것 차이겠죠.

a.com/index.php/info/contact
a.com/info/contact

fancy url이라는 측면도 있구요.