3

I am having a very irritating issue after i enabled the SSL in my website. I changed the Base URL (Secure) from http to https and I set "Use Secure URLs on Storefront" to YES. Then I regenerated static content via this command line -: php bin/magento setup:static-content:deploy -f

And then i cleared my cache. When i see the website it is redirecting to https URL but CSS/JS are not loading and some images are not showing in the Home page. And none of the links to internal pages are working. But same URL is working with http smoothly.

One more thing i noticed that https URLs are working but when i am adding /index.php after the website URL. This is really strange because all http URL works with URL re-write then why not https URL. To remove /index.php from all URLs i am using this .htaccess from the starts. I am still using .htaccess for that purpose.

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

I tried every possible way which are available on the internet. But nothing helps.

  • Can you also explain what you have tried? – Dominic Xigen Jul 5 at 23:53
  • I tried by removing all the contents in generated/ var/cache var/page_cache pub/static folders after then i flushed cache. But it's not working. – Shahzad H. Jul 6 at 5:00
  • Can you post your full htacess? – Dominic Xigen Jul 6 at 10:00
0

Your above url rewrite change is for magento 1

For magento 2 it should be just the case of enabling in backend

Stores > Configuration > Web

  • expand the Search Engine Optimization section
  • set Use Web Server Rewrites to “Yes.”
  • When complete, tap Save Config

Your htaccess should look like this

https://github.com/magento/magento2/blob/2.3/.htaccess

Also maybe set all base URLs as https

Other than that are you able to log into admin with secure admin config set?

  • Thanks Dominic, I have replaced this .htaccess with my .htaccess in root magento folder. But no changed. Still same issue. I have already "Web Server Rewrite" to Yes. I have only set the Base URL (secure) to https. not the Base URL. My admin URL is set with http so it is working fine. I just need to set https only on the front-end. – Shahzad H. Jul 6 at 19:58
  • You say you enabled SSL you got and installed a certificate on server? gethttpsforfree.com – Dominic Xigen Jul 6 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.