可以通过配置Apache的.htaccess文件来解决这个问题。具体地,可以添加以下代码:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^.]+).txt$ index.php?url=$1.txt [QSA,L]
这段代码将重写所有.txt文件的URL,使它们指向index.php。在index.php中,您可以使用自己的处理程序来处理404错误。
上一篇:Apache使用PHP作为输入过滤器。
下一篇:apache数据库配置文件