【问题标题】:.htaccess rewrite rule to remove index.html inbetween the url.htaccess 重写规则以删除 url 之间的 index.html
【发布时间】:2017-10-13 11:17:45
【问题描述】:

在我的应用程序中,我将从网站重定向以打开如下网址链接:

https://[site]/index.html#/Login

在那个 url 站点中,我正在使用 AnuglarJS,现在我需要像“https://[site]/#/Login”一样重定向,但我没有工作。我应该如何编写 .htaccess 以从 URL 中删除 index.html。有什么帮助吗?

【问题讨论】:

    标签: angularjs apache .htaccess url mod-rewrite


    【解决方案1】:

    抱歉,.htaccess 或任何其他服务器端解决方案无法做到这一点。 原因很简单。一个基本的 URL 是这样构建的:

    scheme://host/path?query#fragment
    

    所以在你的情况下

    scheme   => https
    host     => site
    path     => index.html
    query    => N/A
    fragment => /Login
    

    关键是,片段不是浏览器发送给服务器的任何东西。因此,就您而言,从您请求的服务器的角度来看:

    https://[site]/index.html
    

    服务器可以将其重定向或重写到https://[site]/,但不能重定向到https://[site]/#Login,至少如果你想使用不同类型的 #/Login、#/Logout、#/SomePage 等片段。

    您必须在浏览器站点上执行此操作,在您使用 AnuglarJS 的情况下。

    【讨论】:

      猜你喜欢
      • 2011-08-06
      • 2012-03-18
      • 1970-01-01
      • 2014-05-20
      • 2017-03-16
      • 2011-12-06
      • 2016-11-19
      • 1970-01-01
      相关资源
      最近更新 更多