ModSecurity is a firewall that inspects every HTTP request before it reaches your code and compares it against rules describing known attack patterns. When a request matches, it’s rejected with 403 Forbidden and the server log records a line like ModSecurity: Access denied with code 403 (phase 2) along with the rule number [id "..."]. The catch is that legitimate requests sometimes look like attacks, so real users get blocked.
How to recognise it
| Sign | ModSecurity block | Permissions 403 |
|---|---|---|
| When it appears | On one action: saving, submitting, uploading | Every time the page is opened |
| Rest of the site | Works normally | A whole folder may be affected |
| Changes with the content sent | Yes | No |
Common causes
- Content that looks like an attack: strings such as
UNION SELECT,<script>,../or/etc/passwdin a form field or comment, resembling SQL injection or XSS. - Page builders: saving an Elementor page or a Custom HTML block that contains JavaScript or an iframe.
- API calls and webhooks: payloads in an unexpected format, or an automated tool with no clear User-Agent.
- File uploads: double extensions such as
photo.php.jpg. - Long URLs: very long query strings or a huge number of parameters.
- IP reputation: a VPN or shared network address with a history of attacks, which may get a challenge page or a block.
How to fix it (site owners)
1. Record the blocked request
Note the time to the minute, the URL, the IP you sent it from and exactly what you were doing (for example, saving the home page in Elementor). That’s what anyone needs to find the rule in the logs.
2. Look for the rule ID
Open cPanel → Metrics → Errors and look for a line containing ModSecurity at the time of the block. If it’s there, the rule id and the Matched Data part show what triggered it.
3. Isolate the trigger
Save the page without the suspect part (an HTML block, a tracking snippet, pasted text), then add pieces back until the block returns. It’s usually one line that can be written differently or added from a dedicated place, such as the theme’s settings.
4. For developers: send clean requests
- Send data as JSON with a
Content-Type: application/jsonheader instead of packing it into the URL. - Give your scripts a clear User-Agent.
- Avoid raw SQL or HTML in parameters unless you really need it.
curl -i -X POST "https://example.com/api/orders" \
-H "Content-Type: application/json" \
-H "User-Agent: my-shop-sync/1.0" \
-d '{"id": 42, "status": "paid"}'
5. Ask for the rule to be reviewed
If the request is legitimate and can’t be changed, send support the details from step 1 and the rule ID if you found it.
What not to do
Old guides suggest adding SecFilterEngine Off to .htaccess. That directive belongs to an old ModSecurity version; on current servers it usually does nothing or causes a 500 error, and if it did work it would strip protection from the whole site.
Prevention
- Add tracking codes and scripts from the places meant for them, not through the content editor.
- Keep plugins updated; some blocks come from outdated plugins sending unusual requests.
- Test forms and APIs after any major change.
On ArabyHost
Every account is protected by ModSecurity and Imunify360 on a LiteSpeed server. If a legitimate request is blocked, contact support with the time, URL and IP, and support can review the block and the rule behind it. The Araby AI assistant in the panel also reads the error logs and explains whether an error comes from the firewall or from permissions or code.
FAQ
How do I know a 403 comes from ModSecurity and not file permissions?
A ModSecurity block appears on a specific action, such as saving a page, submitting a form or uploading a file, while the rest of the site loads normally. A permissions 403 appears every time you open that page or folder.
Should I just disable ModSecurity?
No. Turning the whole firewall off exposes the site to real attacks such as SQL injection. Find the rule involved and fix the request, or have that one rule excluded for that path only.
I'm a visitor and got blocked. What can I do?
Try again without pasting code or lots of links into the form, and switch off your VPN if you use one. If it keeps happening, tell the site owner the time and the page.