0

I am setting my https in Magento, and I hope every http:// will redirect to https:// automatically. I set the config in apache level

<VirtualHost *:80>
 ServerName local.example.com
 Redirect / https://local.example.com/
</VirtualHost>

It works in frontend and admin.

However, when I try to call the API with POST method http://local.example.com/index.php/rest/V1/integration/customer/token

It returns

{ "message": "Request does not match any route.", "trace": null }

If I call with https://, it returns expected result.

Anyone could help? I would like calling http:// also redirect to https:// and returns correct result.

asked Jun 29, 2017 at 10:17
0

1 Answer 1

0

Add this into your .htaccess located on Magento root:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

Test with Magento EE 2.1.7

Teja Bhagavan Kollepara
3,8275 gold badges33 silver badges69 bronze badges
answered Jun 29, 2017 at 10:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.