Home > Software engineering >  different htaccess for directory issue
different htaccess for directory issue

Time:01-22

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.

CodePudding user response:

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.

  •  Tags:  
  • Related