I am trying to remove index.php from my url, but I am confused which code i used in .htaccess
file and what changes I have to make on related file in codeigniter .
Asked
Active
Viewed 77 times
-2

Sal00m
- 2,938
- 3
- 22
- 33

vaibhav kulkarni
- 1,733
- 14
- 20
-
possible duplicate of [Remove index.php in codeigniter 2.1.0](http://stackoverflow.com/questions/9667226/remove-index-php-in-codeigniter-2-1-0) – Dan Sep 10 '14 at 13:23
-
Possible duplicate of [Remove index.php From URL - Codeigniter 2](https://stackoverflow.com/questions/5155333/remove-index-php-from-url-codeigniter-2) – vaibhav kulkarni May 30 '19 at 07:18
3 Answers
0
Add just this line to your htaccess file :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
</IfModule>

Sal00m
- 2,938
- 3
- 22
- 33

karim karimeri
- 188
- 1
- 4
- 12
0
If you're using IIS, try importing these rules to your web.config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">*
<add input="{URL}" pattern="^system.*" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="index.php?/{R:1}" appendQueryString="false" />
</rule>
<rule name="Rule 2" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="^application.*" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="/index.php?/{R:1}" appendQueryString="false" />
</rule>
<rule name="Rule 3" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?/{R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>

Marie Pizzer
- 3
- 2