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:
As you will see below, RewriteRule
can be used in per-directory config files (.htaccess). In such a case, it will act locally, stripping the local directory prefix before processing, and applying rewrite rules only to the remainder.
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/blabla
is reduced to book/blabla
. Your rule pattern must reflect that behavior:
RewriteRule ^book/blabla$ /book/?name=blabla [NC,L]