I apologize for the seemingly duplicate issue posting but I can’t seem to find someone who has come across my specific issue and resolved it. This post got close but I did everything they did.
here’s where I’m at:
- migrated a wp site to an AWS server running ubuntu 18
- rewrite mod is enabled
- site is in
/home/ubuntu/sites/my-wp-site - site dir is owned by www-data
- site’s virtual hosts file has the necessary
"Directory"section with"AllowOverride All"set - site’s .htaccess file has the rewrite rules set by the permalinks settings in the UI
- apache2 config also has the
"AllowOverride All"set for a"Directory"section pointed at/home/ubuntu/sites
What am I missing?
.htaccess
contents after setting the permalinks to date and time (empty otherwise)
BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/html "access plus 5 minutes"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 6 hours"
</IfModule>
<ifModule mod_headers.c>
Header set X-Endurance-Cache-Level "2"
</ifModule>
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/wp-content/endurance-page-cache/ - [L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP_COOKIE} !(wordpress_test_cookie|comment_author|wp-postpass|wordpress_logg$
RewriteCond %{DOCUMENT_ROOT}/wp-content/endurance-page-cache/$1/_index.html -f
RewriteRule ^(.*)$ /wp-content/endurance-page-cache/$1/_index.html [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
apache2.conf
...
<Directory /home/ubuntu/sites/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
vhost for site
...
DocumentRoot /home/ubuntu/sites/my-wp-site.com
...
<Directory /home/ubuntu/sites/my-wp-site.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Since the domain/site has an ssl, the vhosts file for the ssl is separate and also needs to be updated. Not just the normal port 80 entry.
vhost (:80)
my-wp-site.com.conf
<VirtualHost *:80>
...
DocumentRoot /home/ubuntu/sites/my-wp-site.com
...
<Directory /home/ubuntu/sites/my-wp-site.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
</VirtualHost>
vhost (:443)
my-wp-site.com-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
...
ServerName my-wp-site.com
ServerAlias my-wp-site.com
DocumentRoot /home/ubuntu/sites/my-wp-site.com
<Directory /home/ubuntu/sites/my-wp-site.com>
Options None FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
</VirtualHost>
</IfModule>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0