Mar 30, 2013

siwapp :: File does not exists error


We tested siwapp application, which is an opensource invoicing application, but we had some problems, the error log was full of these:



[Sat Mar 30 17:32:55 2013] [error] [client xx.xx.xx.xx] File does not exist: /home/invoice/web/invoices

The site seemed to work fine otherwise.

It seemed that there was a problem with the app's .htaccess.

The main problem was here:
RewriteCond %{REQUEST_URI} \..+$
which matches all files with a dot in the filename, but the rule was ment to match files that start with a dot.

The fix for this is:
RewriteCond %{REQUEST_URI} /\..+$

After that fix, the app created errors because of a request for favicon.ico.
Well, the fix for that is simple enough
RewriteRule .+/favicon.ico$ favicon.ico [L]

So the whole .htaccess looks like this:
Options +FollowSymLinks +ExecCGI -MultiViews

AddDefaultCharset utf-8 

 
    Order deny,allow
    Deny  from all
 

 
    Order deny,allow
    Deny  from all
 


  RewriteEngine On

  # Rule to test if rewrite module is available during
  # the install process
  RewriteRule test_rewrite1\.txt test_rewrite2.txt
  
  RewriteRule .+/favicon.ico$ favicon.ico [L]

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  RewriteCond %{REQUEST_URI} /\..+$
  RewriteCond %{REQUEST_URI} !\.html$
  RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule (.*) index.php [L,QSA]

2 comments:

Pratap Reddy said...
This comment has been removed by the author.
Pratap Reddy said...

Dear Sir,

I am trying to install Siwapp on my system (localhost).
 
I am using Windows 7 OS, WAMP server.

I activated rewrite_module.

I am getting the following error while I try to access the page index.php

Not Found

The requested URL /Projects/Invoice/Working/index.php was not found on this server.

I try to change .htaccess file rewrite condition

From
RewriteCond %{REQUEST_URI} \..+$

To
RewriteCond %{REQUEST_URI} /\..+$

Still I am getting the same error.

Please help me to solve the issue.

Hope to hear from you soon.

Thank You.