Limit Redirect to certain page types?

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 23 Jul 2012, 16:09

Limit Redirect to certain page types?

23 Jul 2012, 16:11

Hello - I am using the rule from Helicon's examples which routes non-https to https, however I would like to have this only applied to URLs ending in .aspx . Can someone point me in the direction of what needs to be added? Currently the rules I have are:

RewriteEngine on

#Fix missing trailing slash char on folders
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

#Redirect non-HTTPS to HTTPS
RewriteCond %{HTTP:Host} (.*)
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (.*)
RewriteRule .? https://%1%2 [R,L]

Thanks in advance!!

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Limit Redirect to certain page types?

24 Jul 2012, 07:58

hello,

Try using the following:

Code: Select all
RewriteEngine on

#Fix missing trailing slash char on folders
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

#Redirect non-HTTPS to HTTPS with .aspx
RewriteCond %{HTTP:Host} (.*)
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ([^.]+\.aspx) [NC]
RewriteRule .? https://%1%2 [R,L]


Regards
Andrew

User avatar
Posts: 2
Joined: 23 Jul 2012, 16:09

Re: Limit Redirect to certain page types?

24 Jul 2012, 11:43

This looks like it accomplished exactly what I needed. Thanks!

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 16 guests