哈希键URL参数?

时间:2011-03-03 22:09:36

标签: url hash rewrite ip-address

如何生成此类型的网址:

http://www.foo.bar/#/project/123

2 个答案:

答案 0 :(得分:2)

在Javascript中:

location.hash = "/project/123";

然后当应用程序加载检查哈希值时,将用户重定向到“哈希”网址。

if(!!location.hash) {
    location.href = "http://foo.bar" + location.hash.substring(1);
}

答案 1 :(得分:0)

在.htaccess文件中,您可以设置重写(如果您使用的是Linux)。在Windows机器上,您将使用IIS进行重写。

有关详细信息,请参阅this page

相关问题