I'm using CEv2.2.2 and run on ubuntu 16.04 with apache2 server. I have set up a live site without ssl certificate and it is working fine. But then after I installed SSL certificate, the https:// page is all messed up.
and in comparison:
I have already tried:
bin/magento setup:static-content:deploy -f
I have tried checking the file permissions, but can't find anything wrong (or I may have lost my mind not knowing what to look for).
If I do the SSLEngine rewrite to force http to redirect to https, everything broke. So I removed that from .htaccess. So I can access the page both with http and https, and only http works.
What gives? Thanks for any help!
First check in admin that you've setup base URL for both http and https correctly and for media as well.
run below commands :
rm -rf pub/static/frontend/* pub/static/adminhtml/* var/cache/ generated/* var/page_cache/ var/view_preprocessed/ var/composer_home php bin/magento setup:static-content:deploy
php bin/magento c:f
Note : don't use -f while deploying static content if your site is in production mode.
if these solution doesn't work, get help from this answer:
No still doesn't work.
In admin panel, base url section,
base url and base link url are both http://www.sostransfer.com/
base urls (Secure) section,
secure base url and secure base link url are https://www.sostransfer.com/
No url for static view files or media files are set.
I have found the following behaviour, anything with https: cannot be found, while clearly the file exists via http get. For example,
returns 404 Not Found
returns 200 OK
Make sure you have in system configuration --> web --> secure urls to allow ssl in front end.
and your base url(s) have a '/' in ending.
yes all URL's have '/' at end.
In admin panel setting "Use Secure URLs on Storefront" to "yes". Does not make any difference.
The problem is server can't find the file via https request while it serves the file for http request. What would cause a server to not finding the file when requested through https? It's the same file, located in the same directory. Is there some configuration problem with my ssl installation?
Here's how I installed it. I just added the following in the apache conf file:
Check with apache conf tool and all fine. IP and paths all correct.
I noticed the Virtualhost:80 section has some extra directives:
Options Indexes FollowSymLinks MultiViews
Do I need to include these in 443 section as well?
Oh my god, I think I just answered my own question.
Added the missing directives in the Virtualhost:443 section and it worked! I think it's because it didn't use .htaccess in the magento folders if the apache conf directive is not set to use them.