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: Yet another URL Rewrite question
Author
Message |
devas
Newbie


Joined: 12 September 2011
Location: Brazil
Posts: 3
Posted: 12 September 2011 at 2:14pm

Good afternoon,

 What I want is pretty basic but I'm struggling with this for hours.

 I have an institutional page, let's call it mydomain.com. This page has URL Rewrite in hosting server, but I don't know exactly what version.

 All I want is to redirect www.store.mydomain.com, store.mydomain.com and www.mydomain.com/store to storehosting.com/store.

Questions: Do I need to create subdomains (CNAMEs)? Do I need to create a folder called store in mydomain.com? If so, does it have to have an index.htm?

I'm trying to use htaccess in webroot folder inside mydomain.com.

Here's a copy of what I did so far:

Code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^store\.mydomain\.com$
RewriteRule ^ http://www.storehosting.com/store%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.store\.mydomain\.com$
RewriteRule ^ http://www.storehosting.com/store%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.mydomain\.com/store$
RewriteRule ^ http://www.storehosting.com/store%{REQUEST_URI} [R=301,L]

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 13 September 2011 at 2:01am

Please try to fix it as follows:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^(?:www\.)?store\.mydomain\.com$ [NC]
RewriteRule .? http://www.storehosting.com/store%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteRule ^store/?$ http://www.storehosting.com/store%{REQUEST_URI} [R=301,L]

__________________
Regards,
Anton
Back to Top
 
devas
Newbie


Joined: 12 September 2011
Location: Brazil
Posts: 3
Posted: 13 September 2011 at 9:49am

Hi Anton, thanks for your quick reply!

I'll try your suggestions right now, but could you answer a few questions?

1) Isn't L parameter only needed for the last line?

2) I asked if I would need to create CNAMEs store and www.store, would I need that?

3) What about the folder called store for www.mydomain.com/store? Would I need that too?

Thank you again for all your help so far!



Edited by devas - 13 September 2011 at 9:50am
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 14 September 2011 at 5:36am

1. No only. It just says that it the current rule gets matched no consequent rule should be applied.
2. You'll need the subdomains to be mapped correctly
3. You won't need it.

__________________
Regards,
Anton
Back to Top
 
devas
Newbie


Joined: 12 September 2011
Location: Brazil
Posts: 3
Posted: 14 September 2011 at 7:25am

Hi Anton,

I'm having trouble with the last rule. It redirects to www.storehosting.com/store/store instead of www.storehosting.com/store

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 15 September 2011 at 1:30am

Sorry, my fault:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^(?:www\.)?store\.mydomain\.com$ [NC]
RewriteRule .? http://www.storehosting.com/store [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteRule ^store/?$ http://www.storehosting.com/store [R=301,L]

__________________
Regards,
Anton
Back to Top
 

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

Printable version Printable version