移除 index.php
之前一直有個 index.php 贅詞在網址列前面一直沒有處理掉 :
https://blog.givemin5.com/index.php/2019/04/14/linebot-4-qu-de-shi-yong-zhe-zi-xun-profile/
IIS 的處理方式,首先,先安裝 URL Rewrite
在 web.config 增加 :
<configuration> <system.webServer> <rewrite> <rules> <rule name="Main Rule" 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" /> </rule> </rules> </rewrite>
然後到 > 設定 > 永久連結底下,修改自訂連結,移除 index.php


重新導向
安裝完後,尋找 工具 > Redirection
使用正則表達式 :
來源: ^路徑/index.php/(.*)
目標: 完整路徑/$1

完成,灑花~