Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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 修改重写顺序_Php_Apache_Mod Rewrite - Fatal编程技术网

Php 修改重写顺序

Php 修改重写顺序,php,apache,mod-rewrite,Php,Apache,Mod Rewrite,我试图让访问者默认输入某个目录,但我已经多次重写,无法让它工作。基本上,规则如下: Options -Indexes +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f 没有目录?重定向到/全部 RewriteRule ^(.*)$ /all [R] 是否将“/all”作为目录?现在重写为真实的php url RewriteRule ^(all)$ index.php?som

我试图让访问者默认输入某个目录,但我已经多次重写,无法让它工作。基本上,规则如下:

Options -Indexes +FollowSymLinks 

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
没有目录?重定向到/全部

RewriteRule ^(.*)$ /all [R]
是否将“/all”作为目录?现在重写为真实的php url

RewriteRule ^(all)$ index.php?somestuff=not_important_here [L,QSA]
现在当我进行测试时:我导航到我的网站www.somesite.com,该网站被重写为www.somesite.com/all,但现在浏览器显示我的页面有一个间接循环。如何修复它,使其从“/”变为“/all”,然后再次为php重写url

谢谢


编辑:删除了额外的规则,现在只使用这里的内容。

你为什么不默认使用
DirectoryIndex
将访问者发送到
/all
?我不相信这不起作用,因为/all不是目录,它只是一个虚拟目录来重写url,或者我不知道如何…我的错误,这不是你想要做的。你应该发布你的
RewriteCond
行,这样我们就可以看到什么符合你的条件。我把它们都删除了,现在只使用这里的,会编辑一点主帖子