如何使用htaccess为空间创建RewriteRule

I use htaccess for make mu URL clean. My original ULR is http://localhost/bookStore/single_book.php?name=This%20is%20book%20no%204

i use php urlencode() function to make this

http://localhost/bookStore/single_book.php?name=This+is+book+no+4

but now i want to make this like:

http://localhost/bookStore/single_book/This+is+book+no+4

using htaccess

RewriteRule ^single_book/([0-9a-zA-Z_-]+) single_book.php?name=$2 [NC,L]

RewriteRule not working

RewriteCond %{QUERY_STRING} ^name=(.+)
RewriteRule ^(bookStore/single_book)(\.php)$ $1/%1?

This matches if name is in the query string and if the name is the only portion of the query string.

I tested on https://htaccess.madewithlove.be/

And for playing with the regex, i used https://regexr.com/

The trailing ? in the RewriteRule removes the query string.