HTTS site redirect, excluding images

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 14
Joined: 28 Nov 2012, 04:39

HTTS site redirect, excluding images

29 Dec 2016, 20:09

Hi, Yaroslav
I need to set up a redirect from http оn https version of the site, excluding images.

According to Yandex.Images requirements images should be available on both the protocol version.

Please help with the settings redirection rules

PS Happy New Year!

User avatar
Posts: 14
Joined: 28 Nov 2012, 04:39

Re: HTTS site redirect, excluding images

01 Jan 2017, 07:06

Also, I noticed a strange interpretation of the directive

RewriteCond% {HTTPS} on [NC] -- not work

RewriteCond% {HTTPS} =on -- work !

# win 2012R2 iis 8.5, isapi 3.x.112

User avatar
Posts: 14
Joined: 28 Nov 2012, 04:39

Re: HTTS site redirect, excluding images

11 Jan 2017, 15:57

My answer to myself


Code: Select all
# Permanent redirection from http to https protocol except /upload/ files of images
RewriteCond %{HTTPS} =off [NC]
RewriteCond %{HTTP_HOST} ^mydomain.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/upload/.*\.(gif|jpe?g|png)$ [NC]
RewriteRule ^(.*)$ https://mydomain.com/$1 [NC,R=301]

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 13 guests