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:

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:

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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With