用哈希重写URL [英] URL rewriting with a hash

查看:125
本文介绍了用哈希重写URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我对网址重写很陌生,并且想知道是否有可能在哈希发挥作用时重写网址。例如,我有以下URL:

  http://testdomain.com/#/test.php 

有没有办法将此重写为:

  http://testdomain.com/index.php?url=test.php 

我不确定这个哈希是否有效地使这个'隐形'在PHP端。我尝试以这种方式捕获请求URL,并且它不会从哈希中读取任何内容。

解决方案

在这一点上,我发现它是不可能的,因为哈希没有发送到服务器,并且只是客户端。


So, I am new to url rewriting, and was wondering if it is possible to rewrite the url when a hash comes into play. For instance, I have the following URL:

http://testdomain.com/#/test.php

Is there a way to rewrite this to:

http://testdomain.com/index.php?url=test.php

I am not sure whether the hash effectively makes this 'invisible' on the php side. I tried to capture the request URL this way, and it does not read anything from the hash on.

解决方案

After reading more up on this, I have found it not to be possible, as the hash is not sent to the server, and is client side only.

这篇关于用哈希重写URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆