Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: sub folder rules not working Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
swampboy
Newbie
Newbie


Joined: 01 May 2008
Location: United States
Online Status: Offline
Posts: 26
Posted: 01 March 2010 at 1:36pm | IP Logged Quote swampboy

I want to redirect anything after /folder to /newfolder/page.aspx

I'm currently using
RewriteRule ^folder$ http\://www.domain.com/newfolder/page.aspx [NC,R=301,L]

but that only seems to work if user surfs to www.domain.com/folder

I tried
RewriteRule /folder (?:/.*)? http\://www.domain.com/newfolder/page.aspx [NC,R=301,L]

but that doesn't work either.

Waht am i doing wrong?
Thx,
Back to Top View swampboy's Profile Search for other posts by swampboy
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10487
Posted: 02 March 2010 at 4:48am | IP Logged Quote Anton

Please clarify what version of ISAPI_Rewrite you are using - 2 or 3.
The config for v3 is:

RewriteBase /
RewriteRule ^folder http://www.domain.com/newfolder/page.aspx [NC,R=301,L]

The config for v2 is:

[ISAPI_Rewrite]
RewriteRule /folder.* http\://www.domain.com/newfolder/page.aspx [I,RP]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
swampboy
Newbie
Newbie


Joined: 01 May 2008
Location: United States
Online Status: Offline
Posts: 26
Posted: 02 March 2010 at 6:11am | IP Logged Quote swampboy

v3. That rule works ok but the problem is that if i have any valid url that begins with the folder name it will redirect.

Example
RewriteRule ^in http://www.domain.com/newfolder/page.aspx [NC,R=301,L]

and then if i have a valid menu item called "initiatives", it will also redirect there.

Also, thanks for clarity on the v2. i do have other rules where i am using http\:// so it's good to know.

But how do i limit the redirect to only that folder and subfolder and not to any word that has those letters in it?
Thx,

Back to Top View swampboy's Profile Search for other posts by swampboy
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10487
Posted: 02 March 2010 at 7:46am | IP Logged Quote Anton

Ok, I see what you want. Please try the following:

RewriteBase /
RewriteRule ^folder(?:/.*)?$ http://www.domain.com/newfolder/page.aspx [NC,R=301,L]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
swampboy
Newbie
Newbie


Joined: 01 May 2008
Location: United States
Online Status: Offline
Posts: 26
Posted: 02 March 2010 at 8:39am | IP Logged Quote swampboy

yep, that did the trick. you rule! 
Back to Top View swampboy's Profile Search for other posts by swampboy
 
swampboy
Newbie
Newbie


Joined: 01 May 2008
Location: United States
Online Status: Offline
Posts: 26
Posted: 02 March 2010 at 8:45am | IP Logged Quote swampboy

This doesn't make sense to me. The first one works fine but the others end up in a loop.
#this works
RewriteRule ^in(?:/.*)?$ http://www.domain.com/r/india.aspx [NC,R=301,L]

#these loop. and i have no other rule that i can see would interfere
RewriteRule ^ca(?:/.*)?$ http://www.domain.com/r/canada.aspx [NC,R=301,L]
RewriteRule ^eu(?:/.*)?$ http//www.domain.com/r/europe.aspx [NC,R=301,L]
RewriteRule ^ap(?:/.*)?$ http//www.domain.com/r/asiapacific.aspx [NC,R=301,L]
RewriteRule ^me(?:/.*)?$ http//www.domain.com/r/middleeast.aspx [NC,R=301,L]

am i missing something obvious?

Back to Top View swampboy's Profile Search for other posts by swampboy
 
swampboy
Newbie
Newbie


Joined: 01 May 2008
Location: United States
Online Status: Offline
Posts: 26
Posted: 02 March 2010 at 8:48am | IP Logged Quote swampboy

NM. Just realized that i didn't have : in anything past ca. my bad. it's all working fine.
Back to Top View swampboy's Profile Search for other posts by swampboy
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum