2

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.

Fangming
  • 24,551
  • 6
  • 100
  • 90
  • Maybe you need `web.config` file? Check [this answer](https://stackoverflow.com/questions/257936/htaccess-or-htpasswd-equivalent-on-iis). – Tpojka Jul 16 '17 at 11:43
  • i tried but it didnt work..or how can i type in web.config ? – codernth nth Jul 16 '17 at 13:07
  • Google for something like "web.config for codeigniter". – Tpojka Jul 16 '17 at 15:09
  • i could not find on even google bro.. i tried all .. i found something .htaccess to web config. but i didnt get .. – codernth nth Jul 16 '17 at 19:54
  • [This one](https://gist.github.com/wmandai/d28cc45f10a19eec0fcb)? Wht error says? Check [this topic](https://forums.iis.net/t/1176707.aspx) too. – Tpojka Jul 16 '17 at 20:28

1 Answers1

0

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>
Nick
  • 2,593
  • 3
  • 30
  • 59