0
如何创建在nginx的使用正则表达式此rewrite
规则:Nginx的主题标签重写规则
http://www.example.com/my-path-here#hashvalue
到
http://www.example.com/my-path-here/#hashvalue?
如何创建在nginx的使用正则表达式此rewrite
规则:Nginx的主题标签重写规则
http://www.example.com/my-path-here#hashvalue
到
http://www.example.com/my-path-here/#hashvalue?
哈希标记是浏览器唯一的概念,从来没有发送到服务器。所以你不能在nginx中重写。因为当你访问http://www.example.com/my-path-here#hashvalue
nginx服务器将只发送http://www.example.com/my-path-here
你需要的是Javascript来处理这样的事情给你。下面是一个示例html页面,它可以做到这一点
<html>
<head>
<script>
var loc = window.location;
if (!loc.pathname.endsWith("/"))
loc.replace(loc.origin + loc.pathname + "/" + loc.hash);
</script>
</head>
<body>
<h1> You are here -
<script>
document.write(loc.href);
</script>
</h1>
</body>
</html>