隐藏 url 但保留子 url

发布于 2024-08-24 17:05:43 字数 960 浏览 5 评论 0原文

我有一个 dot-tk (www.dot.tk) 域,该域重定向到我的博客。 但我有一个问题。如果通过 tk 重定向进入的博客访问者导航到特定帖子,甚至点击指向其他地方的链接,则 URL 栏不会更改以反映更改。它始终仅显示 tk 地址。我希望子网址可见,以便访问者可以复制该帖子的网址并将其发送给朋友,甚至为特定帖子添加书签。 如果读者从正常网址进入博客,这确实很有效。 对此的一种“解决方案”是将此代码放入博客中:

<head>
<script type="text/javascript">if (top!=self) top.location.href=self.location.href;</script>
</head>

使用此代码,即使访问者通过 tk-url 输入,也将始终看到真实的 url,而不是 tk-url。 这是可行的,但如果可能的话,我最好想显示 tk-adress 和子 url。

换句话说...

而不是 http://myblog.blogspot.com它应该是 www.myblog.tk (这有效)

而不是 http ://myblog.blogspot.com/blogpost5 它应该是 www.myblog.tk/blogpost5 (这是我需要帮助,如果可能的话)

我希望我已经说清楚了,我希望有一个解决方案。

提前致谢!

I have a dot-tk (www.dot.tk) domain that redirects to a blog of mine.
But I have a problem. If a visitor of the blog who have entered through the tk-redirection, navigates to a specific post or even follows a link that leads elsewhere, then the URL-bar doesn't change to reflect the change. It always show the tk-address only. I want sub-urls to be visible so that the visitor can copy and send the url of that post to a friend or even bookmark the specific post.
This does works well if the reader has entered the blog from the normal url.
One "solution" to this would be to put this code in the blog:

<head>
<script type="text/javascript">if (top!=self) top.location.href=self.location.href;</script>
</head>

With this code the real url will always be seen, not the tk-url, even if the visitor have entered through the tk-url.
This works, but preferably I would like to show the tk-adress AND the sub-urls, if possible.

In other words...

Instead of http://myblog.blogspot.com it should be www.myblog.tk (this works)

And instead of http://myblog.blogspot.com/blogpost5 it should be www.myblog.tk/blogpost5 (This is what I need help with, if it's possible somehow)

I hope I've made myself clear and I hope there's a solution to it.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

死开点丶别碍眼 2024-08-31 17:05:43

我认为您不想使用此重定向方案。请改用 Blogger 的自定义域名功能

I think you don't want to use this redirection scheme. Instead use Blogger's custom domain name functionality.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文