I added support for https for the domain, But only the main page works How to make Сraft make the default site address with https instead of http?

Upd: Craft 3 on Vestacp and centos. Only the base url and static resources work, that is, only what is actually available. A craft path produces 404, for example, an example.com/admin


Change your site url in your config file.

Add a 301 redirect to your htaccess to send requests for http to https.

# Redirect http to https
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

If that doesn't work for you then I suggest doing some Google searching. There are hundreds of guides on how to redirect http to https.

That's all you need to do.

  • 1
    I've added an example for you. But you could have done a quick Google search to find out how to do it. If you look over to the right on this page you'll probably see a few posts dealing with the same thing.
    – foamcow
    Sep 3 '18 at 10:37
  • I did everything as in this article craftcms.com/support/force-ssl , but it did not help Sep 3 '18 at 11:06
  • Can you give some more information? What happens? Do you get an error or does it simply not redirect? Perhaps update your question with the contents of your htaccess file to help someone debug/understand the issue. Are you using Craft 2 or Craft 3. What is your hosting environment?
    – foamcow
    Sep 3 '18 at 16:11
  • I update answer Sep 3 '18 at 18:47

In example.com.nginx.ssl.conf need to insert:

location / {
    try_files $uri/index.html $uri $uri/ /index.php?$query_string;

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.