.htaccess - Apache mod_rewrite craziness in inheritance -
so have crazy strangeness in mod_rewrites being ignored when child directories have htaccess file (regardless of whether file has conflicting rule or not).
so example redirect /index.html of dir / canonical purposes...
rewritecond %{the_request} /index\.html [nc] rewriterule ^(.*?)index\.html$ /$1 [l,r=301,nc,ne] rewritecond %{request_filename} !-d rewritecond %{document_root}/$1/index\.html -f [nc] rewriterule ^(.+?)/?$ /$1/[r=301,l]
so... if set in root settings, works. once child directory has htaccess of own (even without conflicting rewrite) ignores.
by default, child htaccess files not inherit parent rules.
you'll need add line in each child htaccess files
rewriteoptions inherit
or, better (if want parent rules applied before child ones)
rewriteoptions inheritbefore
Comments
Post a Comment