skip to Main Content

I have tried with following code.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

I have replaced with blank in config file index_page but still not working and getting this error.

404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

Please help me to sort out this.

2

Answers


  1. Chosen as BEST ANSWER

    I have solved the problem. I have made web.config in root directory of codeigniter. My Code is following.

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

    It is working for me. I hope this will help others too.


  2. place your .htaccess file within your codeiginter project directory then write this code in .htaccess

    RewriteEngine on
    RewriteCond $1 !^(index.php|[Javascript / CSS / Image root Folder name(s)]|robots.txt)
    RewriteRule ^(.*)$ project_dir_name/index.php/$1 [L]
    

    Replace “project_dir_name” with you actual directory name in 3rd line.

    If still you have problem then check your controller, method name and permission of folders and files.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search