php - .htaccess in subfolders -
i read tons of topics here on so, reason not works me, , totally confused. know, mess something, cant figure what.
i have site, , index.php
calling router, , show content want.
i've created admin' page, , want webserver use /admin/index.php
every request starting /admin/
here try:
rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^admin/(.*)$ admin/index.php?action=$2 [l,nc] rewriterule ^(.*)$ index.php?action=$1 [l]
i echoing information both index.php
see handles request.
if writing http://localhost
says frontend
.
when try http://localhost/admin/
says frontend
again.
if moving admin' line below first rule this:
rewriterule ^(.*)$ index.php?action=$1 [l] rewriterule ^admin/(.*)$ admin/index.php?action=$2 [l,nc]
then http://localhost/admin/
says admin
good!
but if try http://localhost/admin/users
not there, because admin's router should handle that, says frontend
.
how should set .htaccess
use /admin/index.php
in cases, http://localhost/admin/
in uri?
have this:
rewriteengine on # skip files , directories rewrite rules below rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule ^ - [l] rewriterule ^admin/(.*)$ admin/index.php?action=$1 [l,nc,qsa] rewriterule ^(.*)$ index.php?action=$1 [l,qsa]
Comments
Post a Comment