Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

403 Error handling

I have a basic web application written in PHP I am looking to secure, app is located on a local web server.

When using the following url string :

http://localhost/test/index.php%20and%20substring(database(%20),1,1)=%22a%22

The application is outputting the following error message:

403

I would like the web page to display a message like "URL Provided does not exist"

I created a .htaccess file and dropped it into the directory containing the following:

enter image description here

But I am still facing the error providing the file structure, the server I am using and the port it is communicating on.

What am I doing wrong?

like image 544
Big_Papa_B Avatar asked Apr 27 '26 20:04

Big_Papa_B


1 Answers

For allowing ErrorDocument you need to set AllowOverride to All. For example, this is my virtualhost file:

<VirtualHost *:80>
    ServerName localhost
    ServerAlias php.local
    ServerAlias sub.php.local

    LogLevel debug

    DocumentRoot /var/www/projects/php

    <Directory /var/www/projects/php>
    DirectoryIndex index.php
        AllowOverride All
        Order Allow,Deny
        Allow from All
    </Directory>

</VirtualHost>

You can also set AllowOverride to FileInfo for using ErrorDocument.

See also https://httpd.apache.org/docs/2.4/custom-error.html

like image 63
Sergio Ivanuzzo Avatar answered Apr 30 '26 11:04

Sergio Ivanuzzo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!