Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 目录存在时,$\u GET的.htaccess参数失败_Php_.htaccess_Parameters_Get - Fatal编程技术网

Php 目录存在时,$\u GET的.htaccess参数失败

Php 目录存在时,$\u GET的.htaccess参数失败,php,.htaccess,parameters,get,Php,.htaccess,Parameters,Get,我的.htaccess如下所示 Options +FollowSymLinks -Indexes RewriteEngine On RewriteCond %{HTTP_HOST} ^www.example.org$ [NC] RewriteRule ^(.*)$ http://example.org/$1 [R=301,L] RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] 我的

我的.htaccess如下所示

Options +FollowSymLinks -Indexes
RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.example.org$ [NC]
RewriteRule ^(.*)$ http://example.org/$1 [R=301,L]

RewriteCond %{SCRIPT_FILENAME} !-f

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

我的问题是,在目录的根目录中存在一个目录,比如“test”。当我转到/test时,它将重定向到/test?url=test,而不是像往常一样隐藏它。我想知道是否有办法解决这个问题。我真的不希望重命名或移动导致此问题的目录。

您需要关闭目录斜杠

尝试将以下行添加到htaccess:

DirectorySlash off
这将允许您将/test(不带尾随斜杠)重写为/index.php?url=test。

有没有办法(不启用索引)将它们推送到索引文件中,或者将它们重写为/dir/而不是/dir,这样它们将被拒绝访问?我不想启用索引,因为我真的不想列出那里的文件,但把它们留在一个被拒绝权限的页面上会有点糟糕。我觉得我是两全其美。