【问题标题】:Ionic 4 / Angular folder structure and routingIonic 4 / Angular 文件夹结构和路由
【发布时间】:2020-11-19 19:33:35
【问题描述】:

我想知道是否可以在根级别渲染一个完全分离的网页,并在不更改原始路由的情况下保持应用程序结构,也在根目录中,所以用户会:

https://mystartup.com ->(一个分离的静态html全站,自带index.html和css、jss等...结构)

https://mystartup.com/login -> 离子登录页面

https://mystartup.com/home -> 离子主页

等等……

我可以将整个 PWA 结构移动到一个子目录,但随后,我“丢失”了整个 url 级别并且错过了地址中的简单性,如下所示:

https://mystartup.com ->(一个独立的静态html全站,自带index.html和css、jss等...结构)

https://mystartup.com/app/login -> 离子登录页面

https://mystartup.com/app/home -> 离子主页

等等……

您将如何解决此地址重定向以在 index.html 和 ionic index.html 之间共享根级别?

非常感谢

【问题讨论】:

    标签: angular ionic-framework routes


    【解决方案1】:

    Angular 是 SPA。这意味着将有一个 index.html 文件负责使用客户端脚本显示其他页面。

    你可以试试

    1. 将index.html重命名为angular生成的index2.html。

    2. 服务器上的重写引擎开启。检查这个https://httpd.apache.org/docs/current/mod/mod_rewrite.html

    3. 在您的 .htaccess 中,您需要添加负责重定向到 index2.html 的重定向规则,以防找不到 url。 .htaccess 将与您拥有 index.html 和 index2.html(角度完整构建)的级别相同

      重写规则 ^ /index.html

    【讨论】:

      猜你喜欢
      • 2017-08-22
      • 2011-04-04
      • 2018-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-13
      • 1970-01-01
      相关资源
      最近更新 更多