10
A
回答
14
你可以在你的web.config文件中添加重寫規則。添加以下到system.webServer
部分:
<rewrite>
<rules>
<rule name="Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
10
wwwroot中
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
1
創建一個文件名web.config中您也可以實現類似
<rule name="a rule">
<match url="^xxx/(.*)/(.*)-(.*)\.xxx" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="controller/method/{R:3}" />
</rule>
其他重寫規則有一個條件,是改變$ config ['url_protocal'] ='PATH_INFO';在config/config.php中,這將告訴URL重寫模塊使用重新編寫的URI而不是原始URL,否則你將會有404頁未找到問題。
相關問題
- 1. 如何在Windows Azure上安裝OpenCV?
- 2. 如何在Azure Web Apps上添加重寫配置?
- 3. nowJS在Windows Azure上
- 4. 如何在nginx上重寫?
- 5. 出廠重置Azure上的Windows Server 2016
- 6. 在windows上使用xammp,重寫/ var/www/
- 7. 在Windows上用PHP重寫URL IIS
- 8. 如何在Windows PC上的nginx中啓用url重寫
- 9. 如何在Windows Phone上獲取Windows Azure表實體?
- 10. 在Windows Azure上安裝FPDF
- 11. 腓的Eclipse在Windows Azure上
- 12. 在Windows Azure上安裝EJabberd
- 13. 如何在Windows上編寫mingw-make makefile?
- 14. 如何在Windows上編寫模塊?
- 15. 錯誤:寫ENOTSUP在Azure上
- 16. Windows Azure上的CouchBase。
- 17. Windows Azure上的HttpModules
- 18. 如何攔截/重寫Windows ODBC調用?
- 19. 如何在文件上重寫
- 20. Url在azure上重定向
- 21. Azure WebApp子域名重寫
- 22. 禁用/關閉Windows Azure Web角色中的URL重寫模塊
- 23. 在Azure網絡應用中重寫URL
- 24. 在Azure Web App中重寫策略
- 25. 如何編寫組件直接將文件上傳到Windows Azure Blob?
- 26. 如何從Windows Azure的
- 27. 如何在eclipse中使用windows azure?
- 28. 如何在Windows Azure中創建備份
- 29. 如何在Windows Azure上承載isapi擴展
- 30. 如何在Windows Azure上使用asp.net緩存與多個實例
謝謝,它完美的作品:) – Rbeuque74 2012-04-02 07:46:30
這個設置應該適用於大多數PHP框架(zend 1/2,laravel等) – 2014-09-17 01:03:58
這不是爲我工作,然後我意識到,我將參考移動到我的index.php文件保存在應用程序文件夾(對於Codeigniter)中,因此可能需要記住的一件好事是該文件應該是index.php文件適合您的位置。 – Dusan 2016-04-27 02:27:22