Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
Apache 在服务器配置中应用sspi规则后,mod_rewrite不再生效_Apache_.htaccess_Codeigniter_Mod Rewrite_Sspi - Fatal编程技术网

Apache 在服务器配置中应用sspi规则后,mod_rewrite不再生效

Apache 在服务器配置中应用sspi规则后,mod_rewrite不再生效,apache,.htaccess,codeigniter,mod-rewrite,sspi,Apache,.htaccess,Codeigniter,Mod Rewrite,Sspi,我正在codeIgniter中创建一个项目,使用wamp在本地(Apache 2.4)上进行开发。在整个项目中,我打开了mod_rewrite,通过使用codeigniter项目目录中的.htaccess文件,即C:\wamp\www\codeigniter\.htaccess,删除默认情况下出现在codeigniter URL中的index.php 我们需要在应用程序中使用windows身份验证,因此在最终设法使ldap和模块正常工作之后,我在c:wamp\bin\apache\Apache2

我正在codeIgniter中创建一个项目,使用wamp在本地(Apache 2.4)上进行开发。在整个项目中,我打开了mod_rewrite,通过使用codeigniter项目目录中的
.htaccess
文件,即
C:\wamp\www\codeigniter\.htaccess
,删除默认情况下出现在codeigniter URL中的
index.php

我们需要在应用程序中使用windows身份验证,因此在最终设法使ldap和模块正常工作之后,我在
c:wamp\bin\apache\Apache2.4.4\conf\httpd.conf

<Directory "c:/wamp/www/codeIgniter">
 AllowOverride None
 Options None
 Order allow,deny
 Allow from all

 AuthName "protected"
 AuthType SSPI
 SSPIAuth On
 SSPIAuthoritative On
 SSPIOmitDomain On 

 require valid-user
</Directory>


#如果我们没有安装mod_rewrite,所有404
#可以发送到index.php,一切正常。
#提交人:ElliotHaughin
ErrorDocument 404/index.php

仔细阅读工作原理<代码>无禁用
.htaccess
文件。您至少需要
FileInfo

Htaccess文件处理确实会导致性能下降,因为每次请求都会读取和解析访问文件,而服务器和虚拟主机规则则在Apache启动时读取和缓存。但是,这必须与能够在每个请求规则的基础上更改规则处理的灵活性进行权衡。对于本地开发,您可以忽略此建议

还要了解每个目录处理重写规则之间的差异。特别是,在任何重写规则匹配模式上删除前导的
/
字符。相反,请求URI总是包含前导的
/

RewriteCond %{REQUEST_URI} ^/system/
RewriteRule ^(.*)$ index.php?/$1 [L]
这是有道理的,虽然我不确定这是你正在尝试做的

后记 执行这两条规则的更优雅的方法是将它们结合起来,例如:

RewriteCond %{REQUEST_URI} ^/(system|application)/
RewriteRule ^.* index.php?/$0 [L]

我听从了答案中给出的建议,似乎解决了问题。所以我认为问题在于改变期权指令

我现在更改的
httpd.conf
文件部分如下所示:

<Directory />
 #AllowOverride none
 #Require all granted

 #Options FollowSymLinks
 Options Indexes FollowSymLinks Includes ExecCGI
 AllowOverride All
 Order deny,allow
 Allow from all
</Directory>

<Directory "c:/wamp/www/codeIgniter">
 #AllowOverride FileInfo AuthConfig
 #Options None
 Order allow,deny
 Allow from all

 AuthName "protected"
 AuthType SSPI
 SSPIAuth On
 SSPIAuthoritative On
 SSPIOmitDomain On 

 require valid-user
</Directory>
RewriteCond %{REQUEST_URI} ^/system/
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^/application/
RewriteRule ^(.*)$ index.php?/$1 [L]

谢谢你的回复和链接。如果我将
AllowOverride None
更改为
AllowOverride FileInfo
AllowOverride All
或将其注释掉,我认为这会接受以前的任何指令,例如在
中有
Allow from all
我得到以下403错误:禁止您无权访问此服务器上的/codeIgniter/。我不太明白为什么会出现这个错误页面,因为设置
AllowOverride All
FileInfo
我允许.htaccess进行重写工作,我认为这不会导致被禁止的错误。我想在前面的评论中说“或者注释掉它,我假设它接受任何以前的指令,比如在
中有
允许覆盖所有
“-不会让我像我说的那样读AllowOverride和Options上的文档。你真的想让用户列出你的codeIgniter文件夹目录吗?我不知道除了
AllowOverride FileInfo AuthConfig
下面的选项ymlinks
<Directory />
 #AllowOverride none
 #Require all granted

 #Options FollowSymLinks
 Options Indexes FollowSymLinks Includes ExecCGI
 AllowOverride All
 Order deny,allow
 Allow from all
</Directory>

<Directory "c:/wamp/www/codeIgniter">
 #AllowOverride FileInfo AuthConfig
 #Options None
 Order allow,deny
 Allow from all

 AuthName "protected"
 AuthType SSPI
 SSPIAuth On
 SSPIAuthoritative On
 SSPIOmitDomain On 

 require valid-user
</Directory>
RewriteCond %{REQUEST_URI} ^/system/
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^/application/
RewriteRule ^(.*)$ index.php?/$1 [L]