Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

different htaccess for directory issue

root 
  /question
  /pages
  index.html
  .htaccess

/root/.htaccess

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !^/question

/question/.htaccess

RewriteEngine On
#RewriteBase /

RewriteRule ^question/are-bitcoin-gains-taxable/?$  /pages/questions/viewQuestion.php?id=9 [L]

So what I’m trying to do is separate my htaccess into directories, this current setup is producing /404 error /pages/questions/viewQuestion.php? does exist, I just think its not reading the second .htaccess , Thanks for any help.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You don’t need anything in root .htaccess for this and just a RewriteCond by itself isn’t doing anything anyway.

You just need to have this rule in /question/.htaccess

RewriteEngine On

RewriteRule ^are-bitcoin-gains-taxable/?$ /pages/questions/viewQuestion.php?id=9 [L,NC,QSA]

URI paths in RewriteRule are relative to the directory where .htaccess is located so question/ won’t be matched here.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading