私はワードプレスのウェブサイトに取り組んでいます。URLに存在しない場合、ウェブサイトのURLの最後にスラッシュを追加したい。
この url に対するいずれかの要求が :www.mydomain.com/page/subpage
である場合、実用的に変換されwww.mydomain.com/page/subpage/
ます (url の末尾にスラッシュを追加します)。ユーザーが www.mydomain.com/page/subpage
URLを要求すると、URLが見つからないというエラーが表示されるため、これが必要です。
URL の書き換えには、web.config
ファイルで次のルールを使用します。
web.config ルール:
<rule name="Add trailing slash" 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}/" />
</rule>
前もって感謝します。