php – 角度HTML5模式,路由器将重新加载页面

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 角度HTML5模式,路由器将重新加载页面脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图从我的网站删除哈希标签.我已经通过以下代码实现了.
$locationPRovider.htML5Mode(true);

以及索引文件添加的基本URL.

我的问题是,如果我在重新加载整个页面后接受cont状态.我正在重定向到定义为其他状态的本地状态.

使用的配置是 –

服务器-Appache
数据库MysqL

我在.htaccess中添加了以下代码来重写规则,

RewrITeEngine On
     PHP_value post_max_size 120M 
    PHP_value upload_max_filesize 120M 
     PHP_value max_execution_time 90 



     RewriteCond %{HTTP_HOST} ^54\.201\.153\.244$[NC,OR]

     RewriteCond %{HTTPS} off
     rewriterule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

      RewriteCond %{HTTP_HOST} ^adkarlo.COM$[NC]
        RewriteRule ^(.*)$https://www.adkarlo.com/$1 [R=301,L]

      #RewriteBase /html/
      ErrorDocument 404 /404.PHP

    RewriteCond %{REQUEST_FILENamE} -f
     RewriteRule ^ - [L]
   RewriteRule ^(.*)$index.PHP [L]

预期结果 – 从国家联系人重新加载任何页面我想去同一页面.

为了支持重新加载HTML5模式路由URL,您需要实现服务器端URL重写,以将非文件请求(即,不是显式的现有文件的请求)引导到索引文件,通常为index.html .

documentation

您的重写规则在目标网址中不应有#.相反,使用这个

RewriteEngine on

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

# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.PHP [L]

https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode

另外,不需要设置RewriteBase.

脚本宝典总结

以上是脚本宝典为你收集整理的php – 角度HTML5模式,路由器将重新加载页面全部内容,希望文章能够帮你解决php – 角度HTML5模式,路由器将重新加载页面所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。