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
.htaccess mod#u rewrite适用于'/测试';,但不适用于'/';_.htaccess_Mod Rewrite_Apache2 - Fatal编程技术网

.htaccess mod#u rewrite适用于'/测试';,但不适用于'/';

.htaccess mod#u rewrite适用于'/测试';,但不适用于'/';,.htaccess,mod-rewrite,apache2,.htaccess,Mod Rewrite,Apache2,.htaccess文件中的以下代码行为不正确 RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^(domain\.com)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/(.*)$ /test/$1 [L,QSA] 上述操作将正确地将对“domain.com/uri here”的请求发送到“/

.htaccess文件中的以下代码行为不正确

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^(domain\.com)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /test/$1 [L,QSA]
上述操作将正确地将对“domain.com/uri here”的请求发送到“/test/”目录。。但是,对“domain.com/”的请求未匹配/路由

我不确定环境是否存在问题,尽管由于在另一台服务器上使用相同/类似的代码,所以看起来是这样

我做错了什么


提前谢谢

/
可能与
RewriteCond%{REQUEST\u FILENAME}匹配-d