Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度应用程序-重写问题_Javascript_Angularjs_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

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中编写规则 希望有帮助

我必须将#从应用程序中删除

  • 我在apache服务器上托管的angular应用程序中有两个视图(index.html和page1.html)
  • 创建了指向文件所在文件夹的别名(应用程序演示)
  • url将为:
    当我导航到第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进行了解释?