| Author |
|
swampboy Newbie

Joined: 01 May 2008 Location: United States
Online Status: Offline Posts: 26
|
| Posted: 01 March 2010 at 1:36pm | IP Logged
|
|
|
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 |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10487
|
| Posted: 02 March 2010 at 4:48am | IP Logged
|
|
|
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 |
|
| |
swampboy Newbie

Joined: 01 May 2008 Location: United States
Online Status: Offline Posts: 26
|
| Posted: 02 March 2010 at 6:11am | IP Logged
|
|
|
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 |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10487
|
| Posted: 02 March 2010 at 7:46am | IP Logged
|
|
|
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 |
|
| |
swampboy Newbie

Joined: 01 May 2008 Location: United States
Online Status: Offline Posts: 26
|
| Posted: 02 March 2010 at 8:39am | IP Logged
|
|
|
yep, that did the trick. you rule!
|
| Back to Top |
|
| |
swampboy Newbie

Joined: 01 May 2008 Location: United States
Online Status: Offline Posts: 26
|
| Posted: 02 March 2010 at 8:45am | IP Logged
|
|
|
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 |
|
| |
swampboy Newbie

Joined: 01 May 2008 Location: United States
Online Status: Offline Posts: 26
|
| Posted: 02 March 2010 at 8:48am | IP Logged
|
|
|
NM. Just realized that i didn't have : in anything past ca. my bad. it's all working fine.
|
| Back to Top |
|
| |