[英]How to remove .php extension from web.config file from wordpress root folder?
我在 WordPress 根文件夾中有靜態 PHP 頁面。 在web.config
文件中,我將默認文件更改為靜態 PHP 文件home.php
。 我的網站有一些靜態 PHP 頁面和一些 WordPress 頁面。 對於 WordPress 頁面,我使用永久鏈接更改了 SEO 友好 URL,但靜態 PHP 頁面無法刪除.php
擴展名。
像這樣:
http://reactore.com/contact-us/
--- WordPress 頁面
http://reactore.com/about-us.php
--- 靜態 PHP 頁面
這是我的web.config
文件:
<rewrite>
<rules>
<rule name="WPurls" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
在您的網絡配置中使用此代碼:
<rewrite>
<rules>
<rule name="Imported Rule 1" 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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.