0

i have issue while uploading website , writen with codeigniter framework

as Documentation say that i have to change .htaccess

RewriteEngine on 
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

and change Config.php by delete index.php from 'index_page'

$config['index_page'] = '';

it working fine on local host @ localhost/myapp

when upload rewrite_mode not working , and i have to return index.php in all code

example.com/myapp/index.php/controller/action

i have tried different .htaccess ways but no one fix it

Update :

server i upload on it is windows server !! , is there away to convert .htaccess to web.config on IIS

Ramy Sabry
  • 378
  • 2
  • 9

1 Answers1

1

First, make sure redirects are working. Make a blank .htaccess file in the root of your project (aka http://example.com/myapp), with only this in it:

# This allows you to redirect your entire website to any other domain
Redirect 302 / https://www.google.com/

Visit your app in the browser at http://example.com/myapp and if you are not immediately redirected to Google, then something is wrong with your web server's handling of .htaccess redirects.

If you do get redirected to Google, then redirects are working. Try this in the .htaccess file instead:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

EDIT: For IIS you will need to modify your web.config file to something like from this from: How to rewrite the index.php of Codeigniter on Windows Azure

<rewrite>
  <rules>
    <rule name="Rule" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite> 
Community
  • 1
  • 1
TunaMaxx
  • 1,782
  • 12
  • 18