Converting an Apache URL Rewrite Rule to IIS

Discussion in 'Windows / IIS' started by Will1968, Jun 10, 2013.

  1. The following rule when imported received this error message (see attachment)....

    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|webp|html)(\.gz)?(\?.*)?$">
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule .* - [E=CANONICAL:http://%{HTTP_HOST}%{REQUEST_URI},NE]
    RewriteCond %{HTTPS} =on
    RewriteRule .* - [E=CANONICAL:https://%{HTTP_HOST}%{REQUEST_URI},NE]
    </IfModule>
    <IfModule mod_headers.c>
    Header set Link "<%{CANONICAL}e>; rel=\"canonical\""
    </IfModule>
    </FilesMatch>

    I have also posted the same question on the IIS forum ...

    http://forums.iis.net/t/1199689.aspx/1?Adding+Canonical+Headers+to+Files+Requested

    but I am also posting it here as MAXCDN support thought it might be down to the IIS settings on your servers.

    Many thanks,

    Will
     

    Attached Files:

  2. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    I think there just isn't an equivalent in IIS. I'm not sure which ones failed, but it looks like some of the other rules were converted correctly. You might have to make some adjustments manually:

    http://www.iis.net/downloads/microsoft/url-rewrite
     
  3. Many thanks for looking.
     

Share This Page