Hi all, so I'm using mod_rewrite with .htaccess to rewrite my urls.

RewriteEngine on

Options -Indexes
RewriteBase /

# Disable rewrite for specific directories 
RewriteCond %{REQUEST_URI} !^/admin/
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^/\.]+)/?$ index.php?id=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?id=$1&newsyear=$2 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?id=$1&newsid=$3&newsyear=$2 [L]

That's my .htaccess file. The problem I'm running into is that if I try to access any of the sub directories under admin the rules seem to be interfering. So when I go to admin/news I get /admin/news/?id=admin&newsyear=news and content from my public side instead.

My goal is to block direct access to a couple of directories under the admin section so that you can't access them via the address bar and I ran into this problem while trying to figure that out.

my file structure is

cms_content - which has all the site files in it
index.php - home page 

I want to disable any and all rewrite rules for the admin directory and it's subdirectories and block access to two of the folders inside admin. Thanks.

try to change admin rule with :

RewriteCond %{REQUEST_URI} !/admin

Check if it is working or not?

ck direct access to