大佬教程收集整理的这篇文章主要介绍了iis-7 – 为AngularJS配置IIS URL重写模块HTML5Mode仍无效,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode?
我已经对上面链接中的问题中显示的IIS进行了更改,并设置了基本URL,并且当我访问根站点时该站点正常工作(即http:// localhost / appname /).我的所有观点和路由都很好.
然而;当我尝试在新的标签页或浏览器窗口中访问特定的URL(即http:// localhost / appname / about)时,我得到一个404.还有什么我错过了吗???
我正在运行安装了URL重写模块的Windows 7,IIS 7.
并将其添加到system.webServer下的web.config中
<rewrite> <rules> <clear /> <rule name="Html5Mode" enabled="true" stopProcessing="true"> <match url="^(.+)$" negate="true" /> <conditions> <add input="{requEST_URL}" pattern="^(.+)$" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" logRewrittenUrl="true"/> </rule> <rule name="AngularJS" 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" /> <add input="{requEST_URI}" pattern="^/(api)" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" /> </rule> </rules> </rewrite>
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <clear /> <rule name="Html5Mode" enabled="true" stopProcessing="true"> <match url="^(.+)$" negate="true" /> <conditions> <add input="{requEST_URL}" pattern="^(.+)$" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" logRewrittenUrl="true"/> </rule> <rule name="AngularJS" 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" /> <add input="{requEST_URI}" pattern="^/(api)" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" /> </rule> </rules> </rewrite> <handlers> <clear /> <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryLisTingModule" resourceType="Either" requireAccess="Read" /> </handlers> <staticContent> <mimeMap fileExtension=".*" mimeType="application/octet-stream" /> </staticContent> </system.webServer> </configuration>
以上是大佬教程为你收集整理的iis-7 – 为AngularJS配置IIS URL重写模块HTML5Mode仍无效全部内容,希望文章能够帮你解决iis-7 – 为AngularJS配置IIS URL重写模块HTML5Mode仍无效所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。