I have a problem with a redirect in my .htaccess-File. Basically I want to send all requests to the HTTPS, which works perectly:

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.domain.de/$1 [R,L]

Now I need the exception for a few images: For example, when its /fileadmin/rss.png it has to be http://www.domain.de/fileadmin/rss.png and not the HTTPS version. Whatever I've tried so far, nothing worked. For example; I've added a RewriteCond %{SERVER_PORT} 443 at the front and set the RewriteRule for the specific image. But still, the redirect was set to HTTPS. Any ideas?

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/fileadmin/rss\.png$
RewriteRule (.*) https://www.domain.de/$1 [R,L]

Be sure you're familiar with the mod_rewrite documentation.

  • Ahhh! I've tried to make seperate redirects for those and probably the first one had a higher priority than the ones below. Thank you so much! :) – Keenora Fluffball Feb 11 '14 at 9:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.