CodeIgniter Forums

Full Version: Another mod_rewrite question from noob
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]tiono[/eluser]
hello i'm noob in CI. Have problem with mod_rewrite to omit index.php from the URI. Oh ya please pardon me for my bad english.

Before I started, I must mentioned that I already search this forum, read all the topic related with mod_rewrite problem, googling, run some simple test but still stuck in this problem. So here i am posting new topic about mod_rewrite. So let's start :cheese:

My web server configuration is as followed
Apache/2.0.52 (Win32)
PHP/4.4.6

I have an admin page built using CI. It is my first CI applications. URL to access it is http://webadmin.testing.nature (I use apache name-based virtual hosting). The root path in windows is E:\wwwroot\testing\webadmin. I created one controller call packages for testing. When I point to http://webadmin.testing.nature I get CI welcome page. When I point to http://webadmin.testing.nature/index.php/packages I get list of available packages which are loaded from mysql db. Now I wish to omit index.php from URL so I can access http://webadmin.testing.nature/packages. Here is what I try to do to achive that.

Set $config['index_page'] = ""; at file E:\wwwroot\testing\webadmin\system\application\config\config.php

Create .htaccess file in folder E:\wwwroot\testing\webadmin. Content of the file is :
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Then I try to access http://webadmin.testing.nature/packages and what i got is
Code:
Not Found

The requested URL /packages was not found on this server.

I check phpinfo() and i can see mod_rewrite in loaded modules section.
Code:
Loaded Modules    
core mod_win32 mpm_winnt http_core mod_so mod_access mod_actions mod_alias
mod_asis mod_auth mod_autoindex mod_cgi mod_dir mod_env mod_imap
mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_rewrite
mod_setenvif mod_userdir sapi_apache2
So mod_rewrite should be loaded already.

Then I tried to change .htaccess to
Code:
Options FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine on
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>
but also get the same error message.

I tried testing if mod_rewrite working or not by following this tutorial i found. I place the rewrite.php file in folder E:\wwwroot\testing\webadmin\test and access http://webadmin.testing.nature/test/rewrite.php. When i click on link2.html link, then I get this error message
Code:
Not Found

The requested URL /test/link2.html was not found on this server.

So I'm totally stuck now. What else should i check? Please help. Thanks in advance.

El Forum

[eluser]tiono[/eluser]
I just tried follow solutions from http://codeigniter.com/wiki/Dreamhost_.htaccess/ but still no luck.

El Forum

[eluser]tiono[/eluser]
Finally manage to make it works by changing "allowoverride none" to "AllowOverride FileInfo" at apache configuration file httpd.conf for my document root directory.