This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: www. redirection
Author
Message |
abodesi
Newbie


Joined: 20 September 2011
Location: India
Posts: 3
Posted: 20 September 2011 at 1:16am

hi i have several domains mapped to same physical folder

I need to redirect the requests http://domain-somepostfix.com to http://www.domain-somepostfix.com

this is working
RewriteCond %{HTTP_HOST} ^domain-somepostfix\.com$ [NC]
RewriteRule (.*) http://www.domain-somepostfix.com/$1 [R=301,L]

The postfix remains same for all
only 'domain' changes
but I need to add rule for each n every domain
how can this rule be made universal


Edited by abodesi - 20 September 2011 at 1:19am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 20 September 2011 at 8:35pm

Hello,

Please, try using the following:

RewriteCond %{HTTP_HOST} ^domain-([^.]+)\.com$ [NC]
RewriteRule (.*) http://www.domain-%1.com/$1 [R=301,L]

But there's more elegant "non-www to www" example in examples section

Regards
Andrew
Back to Top
 
abodesi
Newbie


Joined: 20 September 2011
Location: India
Posts: 3
Posted: 21 September 2011 at 1:41am

Thanks a lot Andrew
Ive used it with slight modification

RewriteCond %{HTTP_HOST} ^([^.]+)\-postfix.com$ [NC]
RewriteRule (.*) http://www.%1-postfix.com/$1 [R=301,L]



Edited by abodesi - 21 September 2011 at 1:42am
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version