RewriteCond %{QUERY_STRING} (.*)Itemid=111&(.*) [NC]
RewriteRule .* /d/index.php?%2 [R=301,L]
Works great for addresses /index.php?Itemid=111&board=100.300
But doesn't work for /d/index.php?Itemid=111&board=100.300
That is, if it is in a subdirectory, redirection does not work.
I tried the code for .htaccess
that I showed above.
UPDATE:
In the /d/
directory there is a .htaccess
file with the code:
RewriteEngine On
RewriteBase /d/
RewriteRule ^$ index.php [R=301,L]
MrWhite, thanks a lot for the tip! In the
/d/
directory there was a.htaccess
file with the code:RewriteEngine On
RewriteBase /d/
RewriteRule ^$ index.php [R=301,L]
I removed this and now it works.
Yes, that would have certainly caused the problem since mod_rewrite directives are not inherited by default. The mod_rewrite directives in the child config (/d/.htaccess
) would have completely overridden the mod_rewrite directives in the parent .htaccess
file in the root. The mod_rewrite directives in the root would not even have been processed.
It would seem these directives in /d/.htaccess
are superfluous anyway so should be removed to resolve this issue.
mod_rewrite inheritance and how the mod_rewrite directives are merged between parent/child configs can be controlled with the RewriteOptions
directive.