hafiz.bhuyan
hafiz.bhuyan

Reputation: 45

AWS WordPress ERR_TOO_MANY_REDIRECTS

I recently migrated from HostGator to AWS. Everything has worked, including the SSL. This happens on all browsers. Here is what I have setup: (Screenshots attached)

An EC2 instance that's running the WordPress AMI and has an Elastic IP assigned EC2
ACM for both domain.com and www.domain.com, verified by DNS on Route 53 ACM
Target Group with port 80 and HTTP protocol being targeted to the EC2 instance Target Group
Load Balancer listening to port 80 and 443 both forwarded to Target Group Load Balancer
Route 53 with the A record using the Load Balancer as an alias Route 53
CloudFront with domain.com as origin domain name(www.domain.com as CNAME), protocol of "Match Viewer", and connected to the ACM certificate CloudFront.

What would be causing the error? Where should I start looking?

Upvotes: 3

Views: 2933

Answers (3)

Eastman
Eastman

Reputation: 125

I had to add these into wp-config.php to stop too many redirects with configuration: ALB -> EKS -> WordPress Pod

define('WP_CONTENT_URL','https://example.com/wp-content/');

$_SERVER['HTTPS'] = 'on';
$_SERVER['REQUEST_SCHEME'] = 'https';

# For some reason updating plugins doesn't work properly without this.
define('FS_METHOD', 'direct');

# In this case, these weren't required, but I left them here to remind if they would be required in some case.
#define('WP_HOME','https://example.com/');
#define('WP_SITEURL','https://example.com/');

Upvotes: 0

Tarod
Tarod

Reputation: 7170

I had a similar problem, and in my case I was able to solve the problem adding this line to .htaccess:

SetEnvIfNoCase X-FORWARDED-PROTO "^https$" HTTPS

Upvotes: 2

Earid
Earid

Reputation: 842

  1. Check URL settings via Administrator Dashboard

enter image description here

  1. or change the URL from wp-config.php

simply add these two lines of code there

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

3. or check deactivating all plugin, anyof plugin maycauing the issue

  1. or try using Simple SSL plugin.

Upvotes: 3

Related Questions