redirect – How to access my wordpress application using two URLs?


I have deployed a simple self managed WordPress application on AWS. My setup looks like this.

AWS CloudFront -> AWS ALB -> EC2 servers [ wordpress runs] -> RDS Database

I have associated a base domain say with my ALB and with my Cloudfront distribution. The issue is that at any point in time, I am able to access the website using only either of the two URLs. And I have figured so far that the WordPress automatically redirects me to the URL which i mention in the Site URL and the HOME URL settings in the admin dashboard.

As an example, if i updated my site URL and HOME settings to point to my CF URL, and then type my ALB domain name in the browser, I automatically get redirected to the CF URL.
Upon inspecting, i see a 301 status code and then this as one of the response header.
X-Redirect-By : WordPress

The version of PHP/wordpress that i am hosting is PHP/7.2.34.

How can I stop this automatic redirection? How can I access my website using both the URLs?

Gaurav Parashar 1 year 2021-11-24T21:25:18-05:00 0 Answers 0 views 0

Leave an answer