"Not Found" When Creating Draft or Adding Items

Hi Dolibarr Forum!

I’ve been facing this issue since version 22.0.2 and assumed upgrading to 22.0.3 would resolve it.

However, when creating a draft New Price Request or a Purchase Order, adding an item after clicking Add leads to a Not Found page.

I need help fixing this problem.

please check your web server log, for example with apache at:
/var/log/apache2/

most of the time the log will give you more information about the root cause of the error.

please also switch on DEBUG logging and look in the dolibarr.log file found in the documents/ folder

1 Like

@Kim_KW1975 Thanks, I’ll check the logs and see what turns up.

@jonbendtsen Thanks, I’ll enable that debug option and report back with what I find.

Just now, even opening the draft Expense Reports shows a Not Found error.

It seems that most of the modules might be experiencing the same issue.

Is there any other way to fix this issue for now?

Maybe a patch could work, or will it require reinstalling again?

:white_check_mark: RESOLVED: “Not Found” (404) Error on Module Creation Pages (Draft PO, Expense, etc.)

I was encountering a 404 “Not Found” error every time I attempted to create a new resource (Draft Purchase Order, Expense Report, Price Request) in my Dolibarr installation, which is located in a subdirectory on a hosting environment.

The issue was a conflict caused by leftover, aggressive URL rewriting rules in the root directory’s .htaccess file, likely installed by an unused website builder like Weebly.

:light_bulb: Root Cause Analysis

The root .htaccess file was running a set of rules that attempted to handle all requests on the domain, including those intended for Dolibarr’s subdirectory.

These rules were capturing Dolibarr’s clean URLs (e.g., ../supplier_order/card.php) and incorrectly routing them to an old Weebly handler or simply causing a generic 404 before Dolibarr’s system could process the request.

:hammer_and_wrench: Resolution Steps

I manually cleaned up the conflicting code in the root directory’s .htaccess.

1. Clean the Root .htaccess File

I opened the root .htaccess file (located in /public_html/.htaccess) and deleted all lines between the #Weebly Additions Start and #Weebly Additions End markers.

Crucially, I ensured I kept the cPanel-generated PHP handler block (which configures the PHP version for the server).

Before (Example Snippet):

#Weebly Additions Start
ErrorDocument 404 /w_api/Handler.php
... many lines of RewriteRule and RewriteCond ...
#Weebly Additions End

# php -- BEGIN cPanel-generated handler, do not edit
... (Kept this PHP block) ...

After (Example Snippet):

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php80” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

2. Delete Residual Weebly Files (Optional but Recommended)

To ensure no other file conflicts, I deleted the Weebly-related handler folder and files from the root directory, such as the w_api/ folder.

Result: After performing the cleanup, Dolibarr successfully loads all creation forms and pages, resolving the 404 errors.

If you are on shared hosting and encounter widespread 404 errors in a Dolibarr subdirectory, check your root .htaccess for unintended URL hijacking rules.