Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.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 .htaccess重写第二个问题_Php_.htaccess_Mod Rewrite - Fatal编程技术网

Php .htaccess重写第二个问题

Php .htaccess重写第二个问题,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我在.htaccess中有以下内容: Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_URI} !/includes RewriteCond %{REQUEST_URI} !/images RewriteRule (.*) index.php 它通过index.php重定向所有页面,但includes和images文件夹除外。这是使用异常的正确方法吗?还有一种方法可以只在一个重写秒规则上使用异常,而不是在单独的行上使

我在.htaccess中有以下内容:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/includes
RewriteCond %{REQUEST_URI} !/images
RewriteRule (.*) index.php

它通过index.php重定向所有页面,但includes和images文件夹除外。这是使用异常的正确方法吗?还有一种方法可以只在一个重写秒规则上使用异常,而不是在单独的行上使用每个异常吗?

这对异常很好,不过您可以在规则之间添加^in!和/或让它说“从开始”。对于组合它们,您可以执行以下操作:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/(includes|images)
RewriteRule (.*) index.php