I've got a site that's set to use https on all its pages. Both the secure & non-secure urls are set to be https in the admin panel - this is by design.

But I've got a plugin that's creating an xml feed that doesn't work in https.

The file it's creating is /api/xmlrpc - and I'm getting https://mysite.com/api/xmlrpc and the feed wants http://mysite.com/index.php/api/xmlrpc

How do I exempt that file from the HTTPS settings?

My htaccess file: http://pastebin.com/2L0qu3eg


You can set an htaccess rule to check for HTTPS and the url path, similar to the commented out code your htaccess file:

# RewriteCond %{HTTPS} !=on
# RewriteCond $1 !\.(css|js|gif|jpe?g|png|xml) [NC]
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

So it would be something like:

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/api/xmlrpc$ [NC]
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L]
  • Where should I put this in the htaccess file? Up above the other redirects? – SamC Jun 9 '14 at 18:20
  • Within the check for mod_rewrite: <IfModule mod_rewrite.c> and then at the top is fine - the [L] at the end is the flag that that is the last rule that should be processed if the conditions are matched, so as long as you validate the specific url, you should be good. – user4984 Jun 9 '14 at 18:46

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.