I read a ton of topics about it here on SO, but for some reason this doesn't work for me, and I'm completely confused. I know, I ruined something, I just can’t understand it.
I have a website, and it index.php
calls the router and shows the content that I want.
I have created an admin page and I want the web server to use /admin/index.php
for every request, starting with/admin/
Here is what I am trying:
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 repeat some information from index.php
to see which one is processing my request.
If I write http://localhost
, he speaks Frontend
.
When I try http://localhost/admin/
, he speaks again Frontend
.
If I move the admin line below the first rule, for example:
RewriteRule ^(.*)$ index.php?action=$1 [L]
RewriteRule ^admin/(.*)$ admin/index.php?action=$2 [L,NC]
http://localhost/admin/
Admin
, !
http://localhost/admin/users
, , - , Frontend
.
.htaccess
/admin/index.php
, a http://localhost/admin/
URI?