I have a website with some custom api endpoints. I recently installed SSL and configured the website to redirect http visitors to https. I usually do this with the Really Simple SSL plugin.
The https version of the api works as intended. However, for historic reasons, i still have so support for some time an old application which uses the http api endpoint. Calling the http api result in a 404 error.
So i tried to disable the .htaccess automatic rewrite of the plugin and write it by hand, this is what wrote:
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/wp-json.*
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
When I do this the website pages get redirected to https correctly. The HTTPS API works, but the HTTP API version gets oddly redirected to the homepage.
Any help on this?
.htaccess
file you posted that would result in a redirect to the homepage. Have you cleared the browser cache to make sure you aren't seeing a cached redirect? How does the "Really Simple SSL plugin" perform the HTTP to HTTPS redirect?