To answer your question, I grabbed that snippet from a mod rewrite post on here a long time ago and have just re-used it. So, my knowledge of why/how is not very impressive.
I wasn’t having any problems if just passing one variable. So, that snippet was working fine. I was having trouble understanding why two variables (or more) were not working.
business.php and the .htaccess file are both in the DocumentRoot and mod_rewrite is enabled.
I’m pining over your explanation of the {something} directories…bear with me.
The problem with the offered code is that the / was made optional so that it would also match whatever the single version would match - I believe the first atom’s greed would allow the second atom’s greed to only match the last character. My implementation of a one OR two atom (id and/or name) case (where both atoms are anything without /'s and without the trailing slash - it confuses browsers and requires you to use absolute links in your script) would be:
This requires the URI to begin with business/, captures all letters and digits and _'s then OPTIONALLY captures the same characters for name (inside an optional atom which also includes the / between id and name). IMHO, that is the way to make parts of a URI optional, not by making each part optional (you never know what you’d get if you do).
What that’ll do is redirect business/{something} to business/{something}/ so you can redirect it (again) to business.php?id={something}. IMHO, the only thing that does for you is to guarantee that the relative links are relative to the business/{something} directory.
Ditto the second group.
Before I ask why these are two-step and the pairs are now combined, it’s apparent that you’re having a problem so … what’s the problem? If this is in the DocumentRoot’s .htaccess file (and you also use RewriteEngine on), then it should work (because a 500 error would have indicated that mod_rewrite is not enabled). The 404 indicates that business.php is not in the DocumentRoot (or that any relative links are not associated with the {something} subdirectory, i.e., two levels lower in the physical file structure).