Non www to www but with some exceptions
3 posts
• Page 1 of 1
Non www to www but with some exceptions
Hi there
I have a bit of a problem and hoping that an ISAPI guru might be able to help. We have been using the "non www to www" rule to good affect but recently we have seen a bit or a problem during out development process. Let me clarify how our development works (In real world examples, "yourcompany" would just be an acronym for the client we are developing for):
1. We develop on a site with yourcompany.iddev.co.uk
2. We then QA it on a site with yourcompany.idqa.co.uk
3 It then goes live on yourcompany.idlive.co.uk but with additional bindings of the real domain attached e.g. yoursite.co.uk and www.yoursite.co.uk.
This is the same process for every client we have.
Now when the site is live, the rule we use works perfectly for the yoursite.co.uk to be redirected to the www. version. However, when we try and access it on the iddev, idqa or idlive domains its redirecting through to:
http://www.yourcompany.iddev.co.uk/
Which is obviously incorrect. What I need is to be able to do is if, within the domain we find iddev, idqa or idlive, exclude it from the redirect. Is this possible? and if so, how would I got about it?
The rule we are using is the standard:
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301]
Thank you so much for any help on the above and if it doesn't make sense, hopefully I can try and explain it a little better.
Tom Jenkins
I have a bit of a problem and hoping that an ISAPI guru might be able to help. We have been using the "non www to www" rule to good affect but recently we have seen a bit or a problem during out development process. Let me clarify how our development works (In real world examples, "yourcompany" would just be an acronym for the client we are developing for):
1. We develop on a site with yourcompany.iddev.co.uk
2. We then QA it on a site with yourcompany.idqa.co.uk
3 It then goes live on yourcompany.idlive.co.uk but with additional bindings of the real domain attached e.g. yoursite.co.uk and www.yoursite.co.uk.
This is the same process for every client we have.
Now when the site is live, the rule we use works perfectly for the yoursite.co.uk to be redirected to the www. version. However, when we try and access it on the iddev, idqa or idlive domains its redirecting through to:
http://www.yourcompany.iddev.co.uk/
Which is obviously incorrect. What I need is to be able to do is if, within the domain we find iddev, idqa or idlive, exclude it from the redirect. Is this possible? and if so, how would I got about it?
The rule we are using is the standard:
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301]
Thank you so much for any help on the above and if it doesn't make sense, hopefully I can try and explain it a little better.
Tom Jenkins
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Non www to www but with some exceptions
Hello,
Thank you for such retailed and clear description. Try using:
Regards
Andrew
Thank you for such retailed and clear description. Try using:
- Code: Select all
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} !^[^.]+\.(?:iddev|idqa|idlive).* [NC]
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301]
Regards
Andrew
Re: Non www to www but with some exceptions
Andrew, thank you so much, that amended rule works perfectly
Thanks for the quick response as well!
Tom
Thanks for the quick response as well!
Tom
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 31 guests