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>