it-source

iis7의 워드프레스 URL에서 index.php를 제거합니다.

criticalcode 2023. 2. 22. 22:15
반응형

iis7의 워드프레스 URL에서 index.php를 제거합니다.

url에서 index.php를 삭제하고 싶습니다.워드프레스와 iis7을 사용하고 있습니다.어떻게 하면 좋을까요?

이 web.config 사용

(web.config는 Apache Web서버의 .htaccess 파일과 동등한 IIS입니다.루트 폴더에서 찾을 수 있습니다.존재하지 않는 경우 작성해야 합니다.)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
 <defaultDocument>
     <!-- Set the default document -->
      <files>
        <remove value="index.php" />
        <add value="index.php" />
      </files>
    </defaultDocument>
        <httpErrors errorMode="Detailed"/>
    <rewrite>
        <rules>
            <rule name="wordpress" patternSyntax="Wildcard">
                <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

그런 다음 permalinks 페이지에서 "Custom Structure"를 설정하고 값을 지정합니다./%postname%/

IIS 버전에 특화된 URL Rewrite 모듈이 설치되어 있어야 이 기능이 작동합니다(@Spikolynn의 코멘트 덕분에).

Windows Azure 의 Web 사이트를 사용하고 있는 경우, 다른 매우 빠른 해결책은,Microsoft WebMatrix 사이트에 로그인하여 이 기사에서 지적한 대로 web.config 파일을 만듭니다.이제 해결됐네요.를 인스톨 할 필요는 없습니다.URL Rewrite extension아니면 직접 그런 거라도요MS Webmatrix는 문제를 쉽게 해결할 수 있을 것 같습니다.

언급URL : https://stackoverflow.com/questions/12106064/remove-index-php-from-wordpress-urls-in-iis7

반응형