Pretty URL with a custom variable.

Permalink
.htaccess and I have never been great friends. She doesn't listen to me and their is a language barrier between us.

Pretty URL's are working fine on all the site for me, except for one place I want to add a custom variable to the URL (for links to a page that grabs data with a $_GET)

This is on a single page. The single page loads find with a pretty url as long as I don't have an additional variables. It loads fine (with no data grab) as mysite.com/bike/. 147 is the cID for the page.

For now I have links going to mysite.com/cID=147&bikeID=10
While this works, I rather a clean link.

something like mysite.com/bike/10/ works
something like mysite.com/bike/aggressor-2.0/ would be awesome.
to get the bike name, it would be a query like "SELECT model FROM bikes WHERE bikeID=$_GET[bikeID]" (I know that doesn't work exactly, but just example incase anyone needs query parameters for example).

So if anyone can explain to me what I need to script out to make mysite.com/bike/10/ that would be awesome. A break down of the code so I understand it better even more awesome.

If someone can do the same for mysite.com/bike/aggressor-2.0/ would leave me speechless.

Thanks

 
ScottC replied on at Permalink Reply
ScottC
Well you could either write a singlepage, in a singlepage as long as you implement a view method you should be able to redirect based on this variable back to the same controller with different methods args using View::url method.

If you only have say 20 or you want something pretty easy, let me know I've writtenhttp://www.concrete5.org/marketplace/addons/url-director/...
and if you'll give it an honest effort to try to get my add-on to work in your particular use case and if it does you'll give it a great review then I will give you a copy in advance.

Thanks and let me know.

-Scott
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
mrimpatient replied on at Permalink Reply
John,

This worked perfectly. I think I actually read that probably 50 times, but it was a week or two ago, and picked up a lot better understanding of c5 since then, so was able to get it to work this time.

Thanks again!
dclmedia replied on at Permalink Reply
dclmedia
Awesome explanation! This has sorted my problem as well, thanks!!