[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Simple 301 redirect in ISAPI Rewrite for windows server 2003

Posted on 2008-11-11
1
Medium Priority
?
2,743 Views
Last Modified: 2012-05-05
Hi Experts,

I hope you can help, I am ttrying to sort out a simple 301 redirecty rule using ISAPI Rewrite... I am  finding it much harder rthan I would have thought. I have tried adapting a number of rules that I have found onlien but no luck.

I am basically just trying to create  permanant 301 redirect from www.mysite.com/sitepage/scrapbook_photo_albums.html
to
www.mysite.com/pcp/scrapbook_photo_albums.html

I think the problem is that I have a rule that already deals with the /sitepage/ folder and may be interupting I have posted my rule list in the hope that someone can help with this!

Thanks!


[ISAPI_Rewrite]

RepeatLimit 32

# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]

# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]

# This takes all references to images/xxxx.gif, deletes any preceding folders and rewrites the URL as /images/xxxx.gif
# Except for where /merchantadmin/images/xxxx.gif appears.  In this case it keeps it as /merchantadmin/images/xxxx.gif - this is all to
# enable relative paths to work
RewriteRule ((.*/merchantadmin)|(.*/secure)|(?:.*?))(/images/.*) (?2/merchantadmin:)(?3/secure:)$4 [I]

#Makes sure all nested references to the files below get shifted up to the root.
RewriteRule .*?(main.asp.*?) /$1 [I]
RewriteRule .*?(products.asp.*?) /$1 [I]
RewriteRule .*?(custreg.asp.*?) /$1 [I]
RewriteRule .*?(compare.asp.*?) /$1 [I]
RewriteRule .*?(viewcart.asp.*?) /$1 [I]
RewriteRule .*?(search.asp[^x].*?) /$1 [I]
RewriteRule .*?(code/addtoorder.asp.*?) /$1 [I]
RewriteRule .*?(code/addtoordermultiple.asp.*?) /$1 [I]
RewriteRule .*?(code/addtoorderspecial.asp.*?) /$1 [I]
RewriteRule .*?(code/reorder.asp.*?) /$1 [I]
RewriteRule .*?(code/cancel.asp.*?) /$1 [I]
RewriteRule .*?(code/quote.asp.*?) /$1 [I]

# translates /mcp/categoryname.html into main.asp?category=categoryname
RewriteRule /mcp/(.*?)\.html? /main.asp\?category=$1 [I]

# translates /pcp/categoryname.html into products.asp?category=categoryname
# also /pcp:tid4:/categoryname.html into into products.asp?category=categoryname&templateid=4
# also /page8/pcp:tid4:/categoryname.html into into products.asp?category=categoryname&templateid=4&abspage=8
RewriteRule ((?:/page(\d+))|(?:.*?))/pcp((?::tid(\d+):)|(?:.*?))/(.*?)\.html? /products.asp\?category=$5(?4&templateid=$4:)(?2&abspage=$2:) [I]

# translates /scp/categoryname/subcategoryname.html into products.asp?category=categoryname&subcategory=subcategoryname  
# also /scp:tid4:/categoryname/subcategoryname.html into into products.asp?category=categoryname&subcategory=subcategoryname&templateid=4
# also /page8/scp:tid4:/categoryname/subcategoryname.html into into products.asp?category=categoryname&subcategory=subcategoryname&templateid=4&abspage=8
RewriteRule ((?:/page(\d+))|(?:.*?))/scp((?::tid(\d+):)|(?:.*?))/(.*?)/(.*?)\.html? /products.asp\?category=$5&subcategory=$6(?4&templateid=$4:)(?2&abspage=$2:) [I]

# translates /pp/categoryname/subcategoryname/productname.html into products.asp?category=categoryname&subcategory=subcategoryname&product=productname.html
# translates /pp/categoryname/productname.html into products.asp?category=categoryname&product=productname.html
RewriteRule /pp((?::tid(\d+):)|(?:.*?))/(.*?)/(?:(.*?)/)?(.*?)\.html? /products.asp\?category=$3(?4&subcategory=$4)&product=$5(?2&templateid=$2:) [I]

# This rule substitutes /sp/category/clothes/subcategory/shirts/templateid/23/searchbox1/lonsdale.html into /search.asp?category=clothes&subcategory=shirts&searchbox1=lonsdale@templateid=23
RewriteRule /(?:sp|search\.asp)([^/]+)?/([^/]*)?/([^/]*)?(.+?)? /search.asp(?1$1&:\?)$2=$3(?4$4) [N,I]

# translates /sitepage/sitepagename.html into main.asp?sitepages=sitepagename
RewriteRule /sitepage/(.*?)\.html? /main.asp\?sitepages=$1 [I]

# redirect to www
RewriteCond Host: (?:mysite|mysite)\.(?:co\.uk|com)
RewriteRule (.*) http\://www.mysite.com$1 [I,RP]


# redirect main.asp to site root
RewriteCond Host: www\.mysite\.com
RewriteRule /main\.asp http\://www.mysite.com/ [I,RP]

# redirect old site pages to /pcp/ equvilant
RewriteRule http\://www.mysite.com/sitepage/scrapbook_albums\.html http\://www.mysite.com/pcp/scrapbook_albums.html [I,RP]

0
Comment
Question by:alexealden
1 Comment
 

Accepted Solution

by:
alexealden earned 0 total points
ID: 22935616
OK solved this myself ... it was as simple as moving the rule up the list so it was before the other /sitepage/ folder rule. DOH... I thought I had already tried this without success!
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question