Simple 301 redirect in ISAPI Rewrite for windows server 2003

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

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!



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\://$1 [I,RP]

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

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

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alexealdenAuthor Commented:
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!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.