Redirect Loop on new WP MultiSite install on AWS Elastic Beanstalk
-
Set up WordPress 4.5.2 on Elastic Beanstalk following this guide: https://d0.awsstatic.com/whitepapers/deploying-wordpress-with-aws-elastic-beanstalk.pdf
All points of the walkthrough were followed exactly- with the following exceptions…
The MySQL database was set up directly through RDS using ElastiCache rather than through the Eliastic Beanstalk interface. (No issues on database connectivity)
I am using a development domain name rather than the CloudFront domain. (No issues resolving to any page on the site prior to activating multisite)
NOTE: Domain is registered with GoDaddy (updated with custom NS info). Hosted Zone is set up in Amazon Route53. A Record for domain (no www.) is pointed to the CloudFront endpoint. One CNAME record points www. to just domain (no www.).
WordPress Address and Site Address (in WP General Settings) are both pointed to https://mydevsitename.com
The only active Plugins on the site are W3TotalCache (for CDN through CloudFront – Origin Push) and WP SEO by Yoast (Current versions of both). Theme is 2016 – no modifications.
Enable WP multisite was in my wp-config.php file. Enabled subfolder multisite network through Tools / Network. Grabbed the code to change .htaccess and wp-config.php
Here is the .htaccess code generated…
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L]
Made change to .htaccess using the .htaccess file editor in the WP SEO by Yoast plugin to avoid having to deploy a new EBS application. Verified changes by downloading the .htaccess from the active EC2 instance. (Site still accessible from front end after changes made.)
Here are the wp-config changes generated…
define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'mydevsitename.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);
I downloaded the web folder from the staging environment (folder /var/app/current/) locally. I added this code to wp-config.php. (Also checked that the .htaccess file maintained the changes I had made.) Zipped it up and deployed it as a new application in Elastic Beanstalk. This creates a redirect loop on the front end of the site.
I am still able to navigate through WP Admin areas without any issues – 100% functionality. (Uploading media, installing plugins, adding new sites to the network, etc.) However, I can only get to the admin by going to https://mydevsitename.com/wp-login.php
There is ZERO functionality on the front end because of the redirect loop.
The redirect loop only starts AFTER I make the updates to the wp-config file.
I spent an hour on the phone with an Amazon engineer who was able to confirm all of my AWS settings were correct and that the problem was within the code of the site. He suggested .htaccess as the place to look, but the site doesn’t break until wp-config is updated.
This makes no sense to me whatsoever. Any help would be greatly appreciated.
- The topic ‘Redirect Loop on new WP MultiSite install on AWS Elastic Beanstalk’ is closed to new replies.