Here is what the .htaccess file looks like in both the directory represented by “sample” above and the directory “comments”:
RewriteEngine on
RewriteRule ^comments/([0-9]+)?$ index.php?submissionid=$1 [NC,L]
The first URL (http://www.domain.com/sample/comments/68) goes to a 404 error. I have checked, and mod_rewrite appears to be enabled. Also, when I manually enter the second URL, the correct page pulls up.
/sample/comments/68 => /sample/comments/index.php?submissionid=68 is pretty easy BECAUSE the information is all there (and the directory level doesn’t change). The one thing that you may be caught on is that the subdirectory level mod_rewrite treats the / differently than the DocumentRoot. Therefore, Mitt’s suggestion is one EXCELLENT way to handle that. My recommendation, though, is to move your code TO the DocumentRoot (I collect all my mod_rewrite code there to avoid this leading / problem AND to see all the code at once - there often are conflicts).
RewriteEngine on
RewriteRule ^[COLOR="Gray"]sample[/COLOR]/[COLOR="Purple"]?[/COLOR]comments/([0-9]+)?$ index.php?submissionid=$1 [[COLOR="Red"]NC,[/COLOR]L]
… should get the job done (using the gray if in DocumentRoot or making the leading / optional with the purple ‘?’.
BTW, NC is No Case which is totally inappropriate to use on a URI. URIs are case sensitive; {HTTP_HOST} strings are NOT case sensitive so reserve your NC flags for use there and you’ll stay out of trouble.
If mod_rewrite “appears” to be enabled, use the test I provide in my signature’s tutorial article to be sure. Otherwise, you may just be spinning your wheels.