重写规则:我做得对吗?

OK, so using some other threads I found, I was able to (I think) piece this together.

I want to dynamically have site.com/lesson/41, for example, redirect to site.com/shop/lessons_detail.php?id=41

Here's my rewrite rule:

RewriteRule    ^/shop/lessons_detail.php?id=([0-9]+)/?$    lesson/$1    [NC,L] 

Before I unleash it and cause untold chaos (there are well over 600 of these that need to happen), I wanted to make sure I got it right and understood the syntax. Thanks for checking. :)

I think you have the rule and the page it rewrites to reversed. Your regex is supposed to match the URL people see/type the .php?id= is the internal representation (how your server reads it). So it should be something like this (docs):

RewriteRule    ^/lesson/([0-9]+)?$    /shop/lessons_detail.php?id=$1    [NC,L]