.htaccess htaccess仅在根文件夹中

.htaccess htaccess仅在根文件夹中,.htaccess,mod-rewrite,redirect,.htaccess,Mod Rewrite,Redirect,我在寻找答案,但没有找到。我在根文件中有.htaccess,它将/loremipsum/重定向到index.php?url=loremipsum,但它也希望在子目录中工作。我有很多这样的文件,所以将.htaccess文件放入每个人都会很痛苦。有没有办法使它只在根文件夹中工作?如果添加此规则,它将只在不存在的文件和文件夹中工作 Options -MultiViews +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME}

我在寻找答案,但没有找到。我在根文件中有.htaccess,它将/loremipsum/重定向到index.php?url=loremipsum,但它也希望在子目录中工作。我有很多这样的文件,所以将.htaccess文件放入每个人都会很痛苦。有没有办法使它只在根文件夹中工作?

如果添加此规则,它将只在不存在的文件和文件夹中工作

Options -MultiViews +FollowSymLinks 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ index.php?url=$1 [L]

要使重定向规则仅在根目录中工作,请使用以下基于的代码:

Options -MultiViews +FollowSymLinks 
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^/]*)(?!/.*)$ index.php?url=$1 [L]

您使用的规则是什么?
Options-MultiViews+FollowSymLinks
RewriteEngine On
RewriteRule^(.+)/$index.php?url=$1[L]
可能会将
index.php
更改为
/index.php
?我不知道你在子目录中工作是什么意思。我的意思是,如果我去myaddres.com,它是停在同一台服务器上的域,我甚至不能访问index.php,因为.htaccess在根文件夹中