Welcome to WebmasterWorld Guest from 220.127.116.11
So I want a request like:
to be changed to:
so I figured it would be enough to:
RewriteRule /(.*) /index.php?q=$1
but I was wrong. Am I crazy?
Where are you placing this code, in httpd.conf or in .htaccess? The syntax is subtly different, in that leading slashes are stripped from the URI seen by RewriteRule in the .htaccess context.
Therfore, you may need to delete the leading slash for use in .htaccess:
RewriteRule (.*) /index.php?q=$1
Other than that, you've got most of it.
One warning: make sure that your script will NOT return a 200-OK and content for all possible requested URIs... If you do not return 404 under any circumstances, then search engines will see your site as a spider trap - an infinite URI-space where a spider might follow links forever. Therefore, they set an artificially-low depth of spidering on such sites, and you won't easily get all your pages indexed. Some basic syntax-checking and URI-validity checking of URIs before returning content will usually suffice.