简体   繁体   English

将自定义域重定向到特定的tumblr页面,而不是博客

[英]Redirecting a custom domain to a specific tumblr page, rather than the blog

Hoping I can get some help on this one. 希望我能对此有所帮助。 I'm looking into redirecting a domain to a specific tumblr page, rather than to the main blog, to act as a static landing page. 我正在研究将域重定向到特定的tumblr页面,而不是主博客,以充当静态登录页面。 I've managed to find the javascript to redirect like in this case: 在这种情况下,我设法找到了要重定向的JavaScript:

if(location.href == 'http://example.tumblr.com/') location.replace('http://example.tumblr.com/about');;

But this means that I can't get back to the main blog, as it constantly redirects back to the landing page. 但这意味着我无法返回主博客,因为它会不断重定向回登录页面。 Any way that I can have both worlds? 我可以同时拥有两个世界吗? It would be nice to do this for my own site as well. 最好在我自己的网站上执行此操作。 A quick search on here hasn't found this specific issue, at least so far. 至少到目前为止,在此处进行快速搜索并没有发现此特定问题。

So what you're trying to do is when the user goes to your blog he's redirected to another page and when you go there using a link on the blog he isn't redirected? 因此,您要执行的操作是,当用户转到您的博客时,他被重定向到另一个页面,而当您使用博客上的链接转到该页面时,他未被重定向? If you are, add a # to the link to the homepage. 如果是这样,请在首页的链接中添加# Because "http://example.tumblr.com/#" does not equal "http://example.tumblr.com/" 因为"http://example.tumblr.com/#"不等于"http://example.tumblr.com/"

I guess you wanna redirect the user to a certain page if he/she comes from another domain. 我想您想将用户重定向到某个页面(如果他/她来自另一个域)。 You can use this, this'll check the referrer page and make a redirect accordingly. 您可以使用它,这将检查引荐来源网页并相应地进行重定向。

if(!/http:\/\/(www\.)?YOUR_DOMAIN\.com/.test(document.referrer)) {
  window.location = "http://example.tumblr.com/about";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM