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