.htaccess 不重定向基本文件夹中的特定文件

.htaccess 不重定向基本文件夹中的特定文件,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,如果有一个mod write,它可以正常工作,但我希望它不应用于基本文件夹中的某个文件(“somefile.php”)。所有其他文件(尤其是子文件夹中的“somefile.php”文件)应受规则影响 我尝试在RewriteRule之前为这个案例添加RewriteCond,但我无法找出正确的语法。我最后的错误尝试是: RewriteCond %{REQUEST_URI} !(^$)/somefile.php 我想一定是这样的你能纠正这个语法吗? 编辑: 这是我的重写模式的简化版本(根据第一个答案

如果有一个mod write,它可以正常工作,但我希望它不应用于基本文件夹中的某个文件(“somefile.php”)。所有其他文件(尤其是子文件夹中的“somefile.php”文件)应受规则影响

我尝试在RewriteRule之前为这个案例添加RewriteCond,但我无法找出正确的语法。我最后的错误尝试是:

RewriteCond %{REQUEST_URI} !(^$)/somefile.php
我想一定是这样的你能纠正这个语法吗?

编辑:

这是我的重写模式的简化版本(根据第一个答案修改RewriteCond):

我的基本文件夹是:://localhost/somefolder\u但是我不知道它的名字/

编辑2:

我找到了一个解决方法(它没有回答我的语法问题,但似乎解决了根本问题):

ErrorDocument 404 /page404.php
Options -Indexes
DirectoryIndex index.php 
RewriteEngine on
RewriteCond %{REQUEST_URI} !^(/|/index\.php)$
RewriteRule ^(.+)$ main.php?path=$1 [L,QSA]
ErrorDocument 404 /page404.php
Options -Indexes
DirectoryIndex index.php 
RewriteEngine on
RewriteCond %{REQUEST_URI} (.*)somefile\.php
RewriteRule ^([^/]+)/?$ - [L,QSA]
RewriteRule ^(.+)$ main.php?path=$1 [L,QSA]