哈希 url 转换为长 url htaccess? php?
我已经用哈希构建了整个网页(http://example.com/videos#video01
),但问题是当我想在 Facebook 上分享时,显然它无法识别哈希,所以我的问题是:有没有办法将哈希 URL 转换或重定向到长社交友好 URL?
解决方案: 我又尝试了一次 bit.ly 的 API,我得到了 50 个视频,每个视频的网址末尾都有一个哈希值。我制作了一个小缓存脚本(bit.ly 有限制),并用 PHP 编写了一个“foreach”,看起来 bit.ly 接受哈希值。
不管怎样,谢谢。
I have constructed my entire webpage with hashes (http://example.com/videos#video01
), but the problem is when I want to share on facebook obviously it doesn't recognize the hash, so my question is: Is there a way to transform or redirect the hash url to a long social-friendly-url?
Solution:
I tried one more time with bit.ly's API, I got 50 videos to show each with a hash at the end of the url. I made a little cache script (bit.ly has a limit) and I wrote with PHP a "foreach", seem like bit.ly accepts hashes.
Thanks anyway.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
# 和后面的所有内容不会发送到服务器。在您的情况下,您仅发送
http://example.com/videos
。The # and everything after is not sent to a server. In your case you're only sending
http://example.com/videos
.新链接格式:
http://example.com/videos?name=video01
在控制器顶部调用此函数或
http://example.com/videos/index.php
code>:来自这个排名较高的答案的清理片段:https://stackoverflow.com/a/2021729/1296209
New Link format:
http://example.com/videos?name=video01
Call this function toward top of controller or
http://example.com/videos/index.php
:Sanitization snippet from this highly ranked answer: https://stackoverflow.com/a/2021729/1296209