webconfig에 규칙을 다시 쓰고 리디렉션하도록했습니다. 난 파일 확장명을 제거하고 URL 끝에 슬래시를 강제로 추가합니다. 코드가 있지만 파일 확장자를 숨겨서 같은 코드를 시도하면 파일 확장명과 함께 작동하지만 404 페이지로 이동합니다. 참고 - http://example.com/about-us.php/잘web.config : 파일 확장명을 숨기고 URL 끝에 슬래시를 추가합니다.
예상 결과를 작동하고는 - http://example.com/about-us/ 404 페이지로 리디렉션합니다.
web.config 파일을 사용하여 파일 확장명을 숨기고 후행 슬래시를 추가하는 코드를 알려주십시오.
내가 후행 슬래시가 추가, 나는 아래의 몇 가지 규칙을 적용했습니다하지만 난 그냥 참고로
브라우저
에 http://example.com/about-us를 넣어 입력 할 때이 http://example.com/about-us.php/에 저를 소요 - 그것은 http://example.com/about-us/으로 잘 작동하지만, 나는 http://example.com/about-us URL http://example.com/about-us/ 여기내 규칙 목록입니다 원하는 :
,<system.webServer>
<httpErrors errorMode="Custom"><!-- For non-managed files -->
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/404.php" responseMode="ExecuteURL" />
</httpErrors>
<rewrite>
<rules>
<rule name="Add trailing slash rule 1" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}.php/" />
</rule>
<rule name="Add trailing slash rule 2" stopProcessing="true">
<match url="(.*[^/])" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.php/" redirectType="Permanent" />
</rule>
<rule name="hide php extension" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}.php" matchType="IsFile" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="{R:1}.php/" />
</rule>
</rules>
</rewrite>
</system.webServer>
당신은 당신이 뭘하려합니다, 규칙을 추가시겠습니까? –