我有PHP编写的一个基本的web应用程序,我希望确保,应用程序位于本地Web服务器上。
I have a basic web application written in PHP I am looking to secure, app is located on a local web server.
在使用以下URL字符串:
When using the following url string :
的http://本地主机/测试/ index.php文件%20and%20substring(数据库(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"
我创建了一个.htaccess文件,并把它丢进包含以下目录:
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.
我是什么做错了吗?
有关允许的ErrorDocument
您需要设置的AllowOverride
到所有
。例如,这是我的虚拟主机文件:
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>
您还可以设置的AllowOverride
到的FileInfo
使用的ErrorDocument
。
参见 https://httpd.apache.org/docs/2.4/定制的error.html
See also https://httpd.apache.org/docs/2.4/custom-error.html