This was originally posted to StackOverflow: https://stackoverflow.com/questions/52538874/url-redirection-to-different-secure-site

I'm looking for some help with URL Redirection.

I am hosting a website with the following configuration:

  • Application is running on a Tomcat7 App Server
  • Site is hosted on an AWS EC2 Linux Server
  • DNS is configured on AWS R53 Hosted Zone
  • SSL Certificate is installed and configured
  • Tomcat's server.xml file is configured to redirect all http traffic to https

Let's pretend this website's url is www.site1.com. There is a subfolder within this site called biz, which, if accessed via www.site1.com/biz automatically redirects to https.

I also own the domain www.site1.biz, and I would like all calls to www.site1.biz and site1.biz to redirect to 'https: //www.site1.com/biz' BUT for the url in the browser to display 'https: //www.site1.biz

Is this possible? And if so, what is the simplest way to go about this? I don't have an issue setting up a separate app or tomcat instance, but would prefer to avoid this if I can. Lastly, my SSL Certificate is multi-domain and includes www.site1.com AND www.site1.biz.



The simplest way to accomplish this would be to set the DNS records for site1.biz and www.site1.biz to the same IP as the www.site1.com server. Either an A record with the IP or a CNAME record with www.site1.com.

A redirection within the web server itself would lead to the browser indicating the new URL rather than the old. You could however use something like an iframe to encapsulate the new web page within the old.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.