我试图从我的网站删除哈希标签.我已经通过以下代码实现了.
$locationProvider.html5Mode(true);
我的问题是,如果我在重新加载整个页面后接受cont状态.我正在重定向到定义为其他状态的本地状态.
使用的配置是 –
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 .
原文链接:https://www.f2er.com/php/140211.htmlUsing this mode requires URL rewriting on server side,basically you have to rewrite all your links to entry point of your application (e.g. index.html).
您的重写规则在目标网址中不应有#.相反,使用这个
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]
另外,不需要设置RewriteBase.