我正在使用一个友好的 url 解决方案,我通过 VirtualHosts 中的以下几行来实现
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ script.php?$1
所以我可以有像http://example.com/something/something/else/other/things/这样的网址
但是我怎么能向请求任何以 / 开头的文件夹的 url 的用户发送 404 状态。(它不必存在)
Example: http://example.com/.svn/this/should/be/404
Example: http://example.com/other/things/.cannot/access/here
Example: http://example.com/this/should/be/.denied
不应否认的例子:
Example: http://example.com/t.his/is/ok
我试过玩 FilesMatch 和 DirectoryMatch 但这更像是一个虚拟路径,我无法让它工作。谢谢您的帮助