Rules creating multiple 301 redirects
3 posts
• Page 1 of 1
- globalprospects
- Posts: 2
- Joined: 29 Apr 2014, 10:04
Rules creating multiple 301 redirects
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.
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.
Re: Rules creating multiple 301 redirects
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]
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]
- globalprospects
- Posts: 2
- Joined: 29 Apr 2014, 10:04
Re: Rules creating multiple 301 redirects
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
For anyone else in the same situation, changing the order of the rules was the fix that worked for us
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests