Htaccess 重新写入 htaccess 中无效文件扩展名的权限

Htaccess rewirte permission for invalid file extension in htaccess

我不知道这个老问题或者not.i已经google一个小时了,但我找不到解决方案。

在 htaccess 中,我们可以在无效文件时重定向 404(设计的,不是默认的)。

例如:

https://www.example.com/tedgfsst.php

如果我输入无效的文件扩展名,则需要重定向 404 页面

例如:

https://www.example.com/tedgfsst.eg

https://www.example.com/tedgfsst.cr

我终于得到了重写无效文件扩展名重定向到 404 错误页面的答案。

RewriteCond %{REQUEST_URI} /|(/[^.]*|[a-z]|[0-9]\.(php|html?|feed|pdf|vcf|raw))$ [NC]