Javascript 角度应用程序-重写问题
我必须将#从应用程序中删除Javascript 角度应用程序-重写问题,javascript,angularjs,apache,.htaccess,mod-rewrite,Javascript,Angularjs,Apache,.htaccess,Mod Rewrite,我必须将#从应用程序中删除 我在apache服务器上托管的angular应用程序中有两个视图(index.html和page1.html) 创建了指向文件所在文件夹的别名(应用程序演示) url将为: 当我导航到第1页时,它将是: 但当我重新加载页面时,我发现404找不到 我曾尝试在.htaccess、ssl.conf(virtualhost内部)中编写重写规则 在app.js中设置$locationProvider.html5Mode(true)后,在web.config中编写规则 希望有帮助
当我导航到第1页时,它将是:
但当我重新加载页面时,我发现404找不到
我曾尝试在.htaccess、ssl.conf(virtualhost内部)中编写重写规则
在
app.js
中设置$locationProvider.html5Mode(true)
后,在web.config中编写规则
希望有帮助
<system.webServer>
<rewrite>
<rules>
<rule name="AngularJS" 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="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
在app.js
中设置$locationProvider.html5Mode(true)
后,在web.config中编写规则
希望有帮助
<system.webServer>
<rewrite>
<rules>
<rule name="AngularJS" 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="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
在不使用HTML5模式的情况下使用true。我必须从应用程序中删除。只有当我可以将html5Mode设置为trueuse而不设置html5Mode true时,我才能做到这一点。我必须从应用程序中删除#。只有当我能将html5Mode设置为True时,我才能做到这一点。当我们在iis上托管html5Mode时,它在windows中工作。我知道这一点,我需要在apache服务器中使用相同的服务器。您看到链接了吗,它解释了apache?当我们在iis上托管它时,它在windows中工作。我知道这一点,我需要在apache服务器中使用相同的链接。您是否看到链接,它为apache进行了解释?