0

Let's say there's a domain, xyz.com, registered and managed at DNSSimple. A Rails application is configured to serve a website at https://www.xyzDOTcom. There's also a sub-domain, https://get.xyzDOTcom that is configured to serve several landing pages set up using Unbounce.

Now, the SEO guy wants all the Unbounce pages to be made accessible via https://www.xyzDOTcom/storage/PAGE. I implemented this by adding Rack's reverse-proxy to the config.ru.

Problem - The SEO guy also wants the existing https://get.xyzDOTcom/PAGE URLs to redirect (301) to their corresponding https://www.xyzDOTcom/storage/PAGE counterparts. Unbounce allows embedding custom Javascript blogs to its pages, so I tried window.location = , window.location.replace(), window.location.href = etc, but they all resulted in an infinite redirect loop when trying to access https://get.xyzDOTcom/PAGE.

How do I achieve this 301 redirect of https://get.xyzDOTcom/PAGE to the corresponding reverse-proxy https://www.xyzDOTcom/storage/PAGE?

Aayush Kothari
  • 526
  • 3
  • 20

1 Answers1

0

How about

  • Create a new subdomain get2.xyzDOTcom
  • Configure Unbounce to use get2.xyzDOTcom instead of get.xyzDOTcom
  • Configure your Rails app to reverse proxy to get2.xyzDOTcom
  • Setup a new web server for get.xyzDOTcom
  • Let the new web server redirect (301) to www.xyzDOTcom

Note: If the whole exercise is because of SEO, it might be a bad idea to do a JavaScript redirect anyway.

Note 2: Don't know if that is an option for you, but Cloudflare Page Rules would make this a no-brainer.

claasz
  • 2,059
  • 1
  • 14
  • 16
  • Thanks for the answer, however, as per Chris Searles' answer on https://stackoverflow.com/questions/13846738/are-301-redirects-possible-using-javascript-or-jquery, JS redirects seem to do the job from the SEO standpoint as well? – Aayush Kothari Jun 10 '19 at 10:33