Question

I have launched a WordPress instance on AWS using elastic beanstalk. Every now and then AWS restarts my server and when it does all my pages/posts links switch to returning 404.

I can fix this by

  1. logging into my instance through /wp-login
  2. going to the /options-permalinks page
  3. hitting [save changes] (without making any changes)

I am wondering if there is something I can add to my wp-config.php (or similar) to do the same work at launch every time so that I don't have a broken website randomly sitting there waiting for me to notice?

Any help would be amazing.

Was it helpful?

Solution

This answer was based off the comment from @Rup on the question. I needed to add a .htaccess file to my source. I did this with the default contents:

# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

which I got from here: https://wordpress.org/support/article/htaccess/

Adding this at the root of my deploy package (uploaded source) and the problem went away.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top