Apache 带有url重写的奇怪重定向

Apache 带有url重写的奇怪重定向,apache,.htaccess,mod-rewrite,url-rewriting,Apache,.htaccess,Mod Rewrite,Url Rewriting,我的.htaccess文件是: RewriteEngine on RewriteRule (.*) index.php?_url=$1 [QSA,L] 它在大多数情况下都能正常工作。但是,如果请求的url作为真实文件夹存在,它就会变得疯狂 例如,当我请求/random时,它会被重写为index.php?\u url=random,状态代码为200,但对于web服务器上的现有目录/static,它会将301重定向到/static/?\u url=static使用下面的代码进行.htaccess

我的.htaccess文件是:

RewriteEngine on

RewriteRule (.*) index.php?_url=$1 [QSA,L]
它在大多数情况下都能正常工作。但是,如果请求的url作为真实文件夹存在,它就会变得疯狂

例如,当我请求/random时,它会被重写为index.php?\u url=random,状态代码为200,但对于web服务器上的现有目录/static,它会将301重定向到/static/?\u url=static

使用下面的代码进行.htaccess


如果要从重写中排除现有文件和目录,请使用


但是,如何从php获取原始请求uri呢?
<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?_url=$1 [QSA,L]