Click here to Skip to main content
15,885,954 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
First a bit of background, I wrote an ISAPI Extension in C which turns PowerBuilder (a desktop app language) into a web language.

I am trying to create a URL Rewrite rule so that I can support the REST friendly URL pattern.

This is the URL I am trying:
http://localhost/topwizweb/api/resttest/one/two/three

This is the result that I want:
http://localhost/topwizweb/api/resttest.pb/one/two/three

Note that .pb is the file extension I am using for the PowerBuilder code.

What I have tried:

Here is my rule currently:

Pattern: /api/(.*)
Rewrite URL: {HTTP_HOST}/{R:0}/{R:1}.pb

The incorrect result I am getting:
http://localhost:80/localhost/api/resttest/one/two/three/resttest/one/two/three.pb
Posted
Updated 3-Feb-20 3:51am

1 solution

{R:0} is the entire input string, which includes {R:1} and the host.

{R:1} matches the entire URL after /api/. That ends with three, not resttest, so you end up adding .pb in the wrong place.

Try:
  • Pattern: ^api/([^/]+)/(.*)$
  • Rewrite URL: api/{R:1}.pb/{R:2}
 
Share this answer
 
Comments
Roland M Smith 3-Feb-20 20:02pm    
Doesn't work. The .pb doesn't show at all.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900