The solution that worked for me
Leaving this here for others with a similar issue. I had tried already enabling AllowOverride from "None" to "All" for /var/www, but had forgotten to restart apache2 before testing it:
Answer from Avinash in this thread resolved the issue for me:
https://wordpress.stackexchange.com/questions/14685/after-server-migration-only-the-homepage-works/49439
Original issue
I’ve been trying for a while now to get subpages working with HTTPS. I expected it to work by adding a redirect rule to my .htaccess file.
This is my current .htaccess file, with which I can access the subpages domain.com/page1 with http, but not https (which returns a 404). I can access the main site domain.com with both http and https, and I can add a redirect to enforce https, which works for the main site but which makes me unable to access subpages using http.
# 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_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I’m using a Lets Encrypt certificate.
I have tried many different versions of .htaccess. I have tried adding <directory /var/www/domaincom>AllowOverride All</directory>
to apache2 conf, conf for the domain.conf, default-ssl.conf, domain-le-ssl.conf with no luck.
I’m coming up empty with ideas on how to move forward, I don’t understand why subpages give a 404 when I’m using https. Would appreciate some help 🙂
2
Answers
Try to go to the permalink area and save.
I think this will resolve your problem: