Q:

Rewrite URL's with hyphens like forums do it

I would like to rewrite the url to my projects so the page project.php?id=5&name=blahblah would be project/5-blahblah as often seen in forums.
I only managed to do project/5 but as soon as I add the hyphen I obviously get 404
Edit
Right now I got this:
RewriteRule    ^project/([0-9-])/?$    project.php?id=$1    [NC,L]

I also tried stuff like this but I'm terrible at regex >.>
RewriteRule    ^project/([0-9-][^-])/?$    project.php?id=$1    [NC,L]
RewriteRule    ^project/([0-9-])([^-]*)/?$    project.php?id=$1&name=$2    [NC,L]

Btw. it's not so important for me to get the name since I can rely on the id but it would be nice because I might want to do stuff with it

A:

Your regular expression is incorrect.
It should be 
RewriteRule    ^project/([0-9])-[^/]+/?$    project.php?id=$1    [NC,L]
RewriteRule    ^project/([0-9])-([^/]+)/?$    project.php?id=$1&name=$2    [NC,L]

You used ([0-9-]) which means match any single character that is between 0 - 9 including 0 or 9 or a - character.
What you needed instead is match a single character between 0-9 and then match the - character.
And this regular expression will only work if your ID is a single digit number. For multiple number IDs, you can use [0-9]+ instead.

