How come this one works:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/book/blabla$
RewriteRule ^.+$ /book/?name=blabla [NC,L]
But this one doesn’t?
RewriteEngine On
RewriteRule ^/book/blabla$ /book/?name=blabla [NC,L]
I’ve tried many things but it’s confusing me.
If you’re using mod_rewrite in a .htaccess file, the contextual per-directory prefix of the URL path is removed before testing the rules:
That means if you use mod_rewrite in the .htaccess file in the root directory (
/), that path prefix is removed from the URL path. So/book/blablais reduced tobook/blabla. Your rule pattern must reflect that behavior: