Search code examples
apachecodeignitermod-rewritehiawatha

Converting Apache URL rewrite to Hiawatha for Codeigniter


I have a working installation of Codeigniter on Apache2. Trying to run it on Hiawatha (on Puppy Linux). Moved the Codeigniter application to Hiawatha along with databases and updated all settings. But, am unable to get the app running on Hiawatha. It throws a 404 error page.

Though am not sure if this is a problem with URL Rewrite??

Working .htaccess URL rewrite on Apache2:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

How can I convert this to work with Hiawatha?

Tried the below mentioned in Hiawatha official website, with no luck (Hiawatha still throws a 404 error page):

UrlToolkit {
ToolkitID = codeigniter
RequestURI exists Return
Match ^/(index\.php|images|robots\.txt) Return
Match .* Rewrite /index.php
}

Please help. Thanks in advance.


Solution

  • After adding the UrlToolkit settings to hiawatha config file, I needed to insert the following line to the Virtual Host (localhost) as I was accessing the application through localhost:

    UseToolkit = codeigniter
    

    It worked!

    Then I moved the CodeIgniter to a sub directory /codeigniter/. For this to work, I had to modify the below line in UrlToolkit:

    Match .* Rewrite /codeigniter/index.php
    

    Everything works perfect now.