i can not remove index.php from url in codeigniter in iis server

南楼画角 提交于 2019-12-11 02:58:05

问题


I can not remove the index.php from url in IIS. Here my .htaccess file;

RewriteEngine on

RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

also i tried the steps from codeigniter link but it didn't work for my server. it says only for apache servers. but im using iis server. even i enabled rewrite module but it didnt work again.


回答1:


You should include this in your Web.config which is located in the root of your project:

<rule name="Remove index" stopProcessing="true">
  <match url=".*" />
  <conditions logicalGrouping="MatchAll">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  </conditions>
  <action type="Rewrite" url="index.php" />
</rule>


来源:https://stackoverflow.com/questions/45127805/i-can-not-remove-index-php-from-url-in-codeigniter-in-iis-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!