Javascript 角斜杠被编码

Javascript 角斜杠被编码,javascript,html,angularjs,url-rewriting,Javascript,Html,Angularjs,Url Rewriting,我和这个家伙有同样的问题: 如果URL未正确路由,则URL将被编码,在我的路由配置中,它似乎会出错。 没有运气找到原因,我的URL重写工作正常。唯一的例外是当我在HTML5模式下在URL中添加hashbang时。我希望回退到hashbang并将URL重写为html5模式 有人知道这里发生了什么吗 更新: 我将详细说明以前提供的信息: Im在服务器端使用apache,在.htaccess中使用以下配置: Options +FollowSymLinks IndexIgnore */* Direct

我和这个家伙有同样的问题:

如果URL未正确路由,则URL将被编码,在我的路由配置中,它似乎会出错。 没有运气找到原因,我的URL重写工作正常。唯一的例外是当我在HTML5模式下在URL中添加hashbang时。我希望回退到hashbang并将URL重写为html5模式

有人知道这里发生了什么吗

更新: 我将详细说明以前提供的信息:

Im在服务器端使用apache,在.htaccess中使用以下配置:

Options +FollowSymLinks
IndexIgnore */*
DirectoryIndex index.html index.htm
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
</IfModule>



# html5 pushstate (history) support:

 <ifModule mod_rewrite.c>
    RewriteEngine on

        # Don't rewrite files or directories
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^ - [L]

        # Rewrite everything else to index.html to allow html5 state links
        RewriteRule ^ index.html [L]
</ifModule>

我最终通过两件事解决了这个问题:

1.-我将
添加到index.html
2.-我激活了HTML5模式,但没有前缀


这样我可以使用
http://localhost/#/route
http://localhost/route
并且URL被正确重写。

可能有助于提供更多信息。你是怎么主持的?您设置了哪些HTML5模式选项?你能告诉我们路线吗?当然,我已经更新了最初的问题。谢谢
App.config(function($routeProvider, $sceDelegateProvider, $locationProvider) {

  $locationProvider.html5Mode(true);
  $locationProvider.hashPrefix('!');


  $routeProvider.when('/route1/:param', {
    templateUrl: '/html/route1.html',
    controller: 'Route1Ctrl'

  });

  $routeProvider.when('/', {
    templateUrl: '/html/route1.html',
    controller: 'Route1Ctrl'
  });

  $routeProvider.when('/route2', {
    templateUrl: '/html/route2.html',
    controller: 'Route2Ctrl'
  });

   $routeProvider.when('/route3', {
    templateUrl: '/html/route3.html',
    controller: 'Route3Ctrl'
  });

   $routeProvider.when('/route4', {
    templateUrl: '/html/route4.html',
    controller: 'Route4Ctrl'
  });

   $routeProvider.when('/route5', {
    templateUrl: '/html/route5.html',
    controller: 'Route5Ctrl'
  });

   $routeProvider.when('/route6', {
    redirectTo: '/route4'
  });


  $routeProvider.otherwise({
    redirectTo: "/"
  });


});