Rules creating multiple 301 redirects

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 2
Joined: 29 Apr 2014, 10:04

Rules creating multiple 301 redirects

29 Apr 2014, 10:13

Hi, we have a set of rules which is causing us a major headache, particularly with Google. Basically we ended up getting the https version of our site spidered unintentionally, so we added a https-http redirect:

RewriteCond %HTTPS (?!off).*
RewriteCond Host: (?:www\.|dnn\.)?ourdomain\.com
RewriteRule (.*) http\://www.ourdomain.com$1 [I,RP]

Plus we also have another rule further down which we used to "retire" our forum section (the asp script tracks and issues a 410 response):

RewriteCond Host: (?:www\.|dnn\.)?ourdomain\.com
RewriteRule /forum/(.*) /cms/default.asp?page=/forum/&410gone=1 [I,L]

However somewhere we are going wrong as when we try the following URL (https://www.ourdomain.com/forum/Topic1270.aspx) which would satisfy both rules, we get a spinning icon in Chrome and eventually the page times out and gives us a 'This webpage is not available' error.

Removing the https protocol and using the same URL gives the correct behaviour, are we doing something wrong with the https rule?

Many thanks in advance for any help on the subject

PS: I have replaced the real domain with a fake domain (ourdomain) for the purposes of this post.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Rules creating multiple 301 redirects

30 Apr 2014, 05:38

Hello,

First, could you please make sure your rules are working separately. Comment out the second one and check if the first one works on its own and do the same for the second rule.

Another thing you may want to try is change the order of the rules to make it look like this:

RewriteCond Host: (?:www\.|dnn\.)?ourdomain\.com
RewriteRule /forum/(.*) /cms/default.asp?page=/forum/&410gone=1 [I]

RewriteCond %HTTPS (?!off).*
RewriteCond Host: (?:www\.|dnn\.)?ourdomain\.com
RewriteRule (.*) http\://www.ourdomain.com$1 [I,RP]

User avatar
Posts: 2
Joined: 29 Apr 2014, 10:04

Re: Rules creating multiple 301 redirects

30 Apr 2014, 07:43

Thanks for your quick and speedy response, I tried your suggestions and they fixed my problem, so thanks again.

For anyone else in the same situation, changing the order of the rules was the fix that worked for us

Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 0 guests