3

I've successfully redirected my entire Drupal 7 site to HTTPS using the snippet:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

from How to simply make the whole site HTTPS?, but now I want to add an exception for a specific URL (it's an XML feed for products, created with Drupal Commerce + Views Data export). I've tried many variants of this:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !^/xmlfeedurl
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP:X-Forwarded-Proto} !http
RewriteCond %{REQUEST_URI} ^/xmlfeedurl
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

but haven't managed to get it to work. When I visit http://www.example.com/xmlfeedurl, I'm redirected to https://www.example.com/index.php.

I'm guessing that there's some interference with Drupal's rule that redirects all URLs to index.php but I have no idea how to solve this (all the above snippets are placed in the detault .htaccess file, just before Drupal's redirect to index.php). Can someone help?

Your Answer

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

Browse other questions tagged or ask your own question.