"Not Found" When Creating Draft or Adding Items

: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.