title: Rewrite Url with apache2
body: <p>I'm experimenting with CodeIgniter PHP framework, this framework works like:</p>
  
  <p><code>http://localhost:7777/~dhalsim/ci/index.php/blog</code></p>
  
  <p>So, I tried to remove <code>index.php</code> part from there. So far I do these:</p>
  
  <ol>
  <li><p>make <code>$config['index_page'] = "index.php";</code> to <code>$config['index_page'] = "";</code></p></li>
  <li><p>make <code>$config['uri_protocol'] = "REQUEST_URI";</code> from <code>$config['uri_protocol'] = "AUTO";</code></p></li>
  <li><p>enable apache mod_rewrite by "<code>a2enmod rewrite</code>"</p></li>
  <li><p>put a .htaccess file to <code>/ci</code> directory:</p>
  
  <pre><code>RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_URI} ^system.*
  RewriteRule ^(.*)$ /index.php/$1 [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
  </code></pre></li>
  <li><p>And of course restart apache server</p></li>
  </ol>
  
  <p>Here is my apache logs with these configurations:</p>
  
  <pre><code>127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (3) [perdir /home/dhalsim/public_html/ci/] strip per-dir prefix: /home/dhalsim/public_html/ci/blog -&gt; blog
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (3) [perdir /home/dhalsim/public_html/ci/] applying pattern '^(.*)$' to uri 'blog'
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (4) [perdir /home/dhalsim/public_html/ci/] RewriteCond: input='/~dhalsim/ci/blog' pattern='^system.*' =&gt; not-matched
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (3) [perdir /home/dhalsim/public_html/ci/] strip per-dir prefix: /home/dhalsim/public_html/ci/blog -&gt; blog
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (3) [perdir /home/dhalsim/public_html/ci/] applying pattern '^(.*)$' to uri 'blog'
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (4) [perdir /home/dhalsim/public_html/ci/] RewriteCond: input='/home/dhalsim/public_html/ci/blog' pattern='!-f' =&gt; matched
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (4) [perdir /home/dhalsim/public_html/ci/] RewriteCond: input='/home/dhalsim/public_html/ci/blog' pattern='!-d' =&gt; matched
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (2) [perdir /home/dhalsim/public_html/ci/] rewrite 'blog' -&gt; 'index.php?/blog'
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (3) split uri=index.php?/blog -&gt; uri=index.php, args=/blog
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (3) [perdir /home/dhalsim/public_html/ci/] add per-dir prefix: index.php -&gt; /home/dhalsim/public_html/ci/index.php
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (2) [perdir /home/dhalsim/public_html/ci/] trying to replace prefix /home/dhalsim/public_html/ci/ with /
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (5) strip matching prefix: /home/dhalsim/public_html/ci/index.php -&gt; index.php
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (4) add subst prefix: index.php -&gt; /index.php
  127.0.0.1 - - [17/Jul/2009:02:21:41 +0300] [localhost/sid#7f48e8ad2968][rid#7f48e8e634c8/initial] (1) [perdir /home/dhalsim/public_html/ci/] internal redirect with /index.php [INTERNAL REDIRECT]
  </code></pre>
  
  <hr>
  
  <p>Here is the result in Firefox:</p>
  
  <blockquote>
    <p>404 Not Found:<br>
    The requested URL /index.php was not found on this server.</p>
  </blockquote>
  
  <hr>
  
  <p>So, what should I do (or where am I wrong) to get work these URLs?
  <code>http://localhost:7777/~dhalsim/ci/blog/</code> instead of <code>http://localhost:7777/~dhalsim/ci/index.php/blog/</code></p>