如何在Windows Server中启用.htaccess文件

我是新的Windows服务器,我通常会使用.htaccess文件,这是不工作的Windows服务器。 如何在Windows Server中启用.htaccess文件?

我的朋友帮我解决了这个问题。 我正在使用codeigniter框架,我使用了一个web.config文件,而不是.htaccess文件。

web.config看起来像:

 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="MyRule"> <match url="^(.*)$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:1}" appendQueryString="false" /> </rule> </rules> </rewrite> </system.webServer> </configuration> 

另外在我的config.php只需将uri_protocol设置为AUTO

 $config['uri_protocol'] = 'AUTO'; 

.htaccess文件是Apache Web服务器特定的configuration文件。

您必须在Windows中安装Apache才能使用这些configuration文件。

我将假定您正在使用Microsoft的Internet信息服务(IIS)作为您的Web服务器。

像其他人所说的,.htaccess文件是apache软件的一部分 – 它只是在IIS中不是。

你没有说在.htaccess中你想要做什么,在IIS中没有直接的等价物,但是在IISpipe理器中有一些有用的选项。