1. CI의 config.php 파일의 수정
/application/config/config.php파을을 엽니다.
$config['index_page'] = ''; // 항목을 비웁니다.
2. IIS관리자 프로그램의 "URL재작성"기능
IIS관리자를 실행하여 [URL재작성]기능을 실행합니다.
우측의 [작업]메뉴에서 [규칙추가]를 선택합니다.
[인바운드 규칙]의 [URL 검색]항목을 아래와 같이 입력합니다.
패턴은 ^(.*)$로 설정합니다.
[조건]을 추가합니다.
{REQUEST_FILENAME}을 두번 설정합니다.
'파일이 아님', '사전이 아님' 이렇게 두 조건을 추가합니다.
[작업]을 설정합니다.
작업속성 > URL 재작성 항목을 "index.php/{R:1}"값으로 설정합니다.
우측의 [작업]항목에서 [적용]버튼을 클릭하여 설정을 마무리합니다.
IIS관리자를 사용하지 않고 사이트 루트 폴더의 web.config파일을 아래 처럼 직접수정하여도 됩니다.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rewriteMaps>
<rewriteMap name="^(.*)$" />
</rewriteMaps>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
'IT > PHP' 카테고리의 다른 글
Class 'SimpleXMLElement' not found (0) | 2022.02.22 |
---|---|
Codeigniter환경에서 URI encoded image처리 시 주의점 (0) | 2020.07.09 |