Trying to write a rule that will take a relative URL passed into the java program and pass it back with a /index.html appended to the end. Seems simple enough, but the part I'm having difficulty with is with the variability of the final slash that may or may not be in the URL that's passed. Any help is appreciated. Below is the code I have so far.
- George
Code:
rule.setFrom("^/(.*)/[^\\.]+)/?$");
rule.setTo("$1/index.html");
System.out.println(rule.rewrite("/main/auto/boats/"));
- George