简体   繁体   中英

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. I've managed to find the javascript to redirect like in this case:

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/"

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";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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