2016-09-30 25 views
1

我有使用有線URL結構就像一個網站:是否有可能使用漂亮的網址爲PHP沒有的.htaccess

http://www.example.com/course-detail.php?CourseId=NzI=&SubCategoryId=MQ==&DivisionId=MQ==

我想看到類似的結構:

http://www.example.com/course-details/course-name/

注意:該網站託管在Windows服務器上,因此.htaccess無法用於映射URL。

是否有任何其他可能性來更改此URL結構?

在此先感謝。

+0

我想你應該重新標記問題'web.config'和刪除'htaccess'標籤比。 –

+0

謝謝夥伴完成編輯 –

回答

1

您的網站託管在Windows服務器吧?所以.htaccsess不起作用,因爲它與Apache服務器一起工作,在Windows服務器上你必須使用IIS服務器,所以你需要web.config。

我已經做URL重寫與PHP核心Windows服務器上,

試試這個web.config中

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<system.webServer> 
<rewrite> 
    <rules> 
    <rule name="Imported Rule 1" stopProcessing="true"> 
     <match url="^.*$" /> 
     <conditions logicalGrouping="MatchAny"> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" /> 
     </conditions> 
     <action type="None" /> 
    </rule> 
    <rule name="Imported Rule 2" stopProcessing="true"> 
     <match url="^.*$" /> 
     <action type="Rewrite" url="index.php" /> 
    </rule> 
    </rules> 
</rewrite> 
</system.webServer> 
</configuration> 
+0

對不起,但沒有太大的幫助,沒有創建web.config文件的效果 –

+0

你把你的web.config放在哪裏?並請檢查是否有另一個web.config項目文件夾外?在第二個web.config上有兩個web.config效果 – Archish

+0

它位於站點的根目錄中,外面沒有其他web.config文件。 –