Solution: HTTPS SSL certificate causing 404 error with custom permalinks
-
Hi,
since I struggled with this issue for a while, I think it would be helpful to share the solution with the community.
What I have:
Wordpress on Apache with WooCommerce running on Ubuntu (hosted by Linode).
I bought PayPal Pro plugin to accept payments on my website.
Bought SSL certificate from Comodo and activated it (let me know if you need the steps, but it involves running openssl command and copying bunch of certificates) to files. At the end I had default-ssl file in available-sites directory that pointed to my private key, public certificate from SSL company and some intermediate file.
To enable the SSL I had to run “sudo a2ensite default-ssl” and confirmed that SSL was working by going to https://<my websites> that prompts a message “It works!”.When I forced SSL on checkout pages through WooCommerce configuration – I start receiving error 404 (page not found) on these pages.
After quick research I found that there are many posts that indicate “pretty” links are not supported through SSL and the only way to make them work is to change permalinks to default and get this ugly ?page_id link.
This solution was not acceptable for us as all product pages are already hard linked by 3-rd party websites and loosing all these goodies just for the sake of ssl did not make sense.
So, I made executive decision to keep custom permalinks. Finally came across article that suggested to modify default-ssl file and add the same directives that make permalink work in htaccess file.Here is content of my default-ssl file. Please substitute ip address and directory with values applicable to your environment.
<VirtualHost _default_:443>
ServerName <ipaddress>:443
ServerAdmin webmaster@localhostDocumentRoot /home/webadmin/public/<website>/public/
<Directory /home/webadmin/public/<website>/public/ >
AllowOverride All
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</Directory>…. other SSL stuff ….
Lat command:
/etc/init.d/apache2 reloadand I got my https properly showing the webpages with https and custom permalinks.
Hope this helps!
Max
- The topic ‘Solution: HTTPS SSL certificate causing 404 error with custom permalinks’ is closed to new replies.