.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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -