![Picture of Adam Mustill Picture of Adam Mustill](/graphics/unknown.gif)
Adam Mustill - 2008-12-12 16:29:08
I am looking to use this great class on an upcoming project of mine, but currently one issue I am having is preventing me from doing so.
I want my URLs like this: /product/product-name-1
But I also want them accessible via: /product/product-name-1/
If I add a URL rule using $url->add_rule("index.php", "/product/[name]-[id]/"); it is only accessible with the URL /product/product-name-1/. The URL /product/product-name-1 returns the error "Notice: Undefined offset: 2 in C:\xampp\htdocs\url_rewriter.php on line 90".
If I add a URL rule using $url->add_rule("index.php", "/product/[name]-[id]"); then it is accessible via the URL /product/product-name-1, but a blank page appears if I try and access it via /product/product-name-1/.
If I add a URL rule using $url->add_rule("index.php", "/product/[name]-[id]{/}"); then I receive various errors and the page is not accessible via any URL. I had hoped that the {} condition would let me access the page with or without the forward slash, such as in the example provided - $url->add_rule("index.php","/{index.[ext]}" );
I have found if I create two rules - one with the forward slash and one without - then it works, but I don't wish to create two rules for every URL.
Is there anyway to implement optional forward slashes at the end of URLs? Any information would be greatly appreciated.
Regards,
Adam