RewriteEngine On
RewriteRule ^tutorials/([^/\\.]+)/?$ tutorials.php?id=$1 [L]
But it does not work.
My site has mainly (about 10) .htm files. And 1 .php file.
The problem is when the MOD REWRITE comes into effect if the user then clicks to go to any other page the MOD REWRITE causes a problem. It still thinks I want to MOD REWRITE when the user clicks to view a .htm file!
By itself, mod_rewrite doesn’t check if files exist, unless you tell it to. Which you can do by using RewriteCond and %{REQUEST_FILENAME}, like so
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^tutorials/([^/\\.]+)/?$ tutorials.php?id=$1 [L]
This means, if (RewriteCond) the requested URL (%{REQUEST_FILENAME}) is not an existing file (!-f), then apply the RewriteRule. Otherwise don’t apply the RewriteRule.
That would match any letter plus a digit, like a1, b2, c9, d4, etc.
If you’d like to match any letter or digit (which is not the case here I don’t think), you’d use