我已经找到了如何写的东西像
I've figured out how to write something like
www.test.com/test
到
www.test.com/test.php.
这是给一个简单的浏览体验,并掩盖了使用PHP有用。不过,我想走得更远,并禁止访问
This is useful to give a simpler browsing experience and obscure the use of the PHP. However, I'd like to go farther and disallow access to
www.test.com/test.php
完全,并且只允许通过
completely, and allow access only through
www.test.com/test
以prevent人从无非是想以URL发现使用PHP。
in order to prevent people from discovering the use of PHP by simply trying it in a URL.
的问题是,如果我禁止访问
The problem is that if I disallow access to
www.test.com/test.php
然后
www.test.com/test
不再起作用,因为不允许规则重写后触发
no longer works, since the disallow rule is triggered after the rewrite to
www.test.com/test.php
完成的。
这是可能的吗?隐藏使用的编程语言的任何备选建议,欢迎。
Is this possible to do? Any alternative suggestions for hiding the programming language used are welcome.
有一件事情你可以做的是找到PHP地方文件的文档根目录之外并使用AliasMatch指令。如果你的PHP文件在 /var/www-php/www.test.com
尝试
One thing you could do is locate the PHP files somewhere outside of the document root and use an AliasMatch directive. If your PHP files are in /var/www-php/www.test.com
try
AliasMatch ^(.*)$ /var/www-php/www.test.com/$1.php
通常,当你想禁止,除非在特定条件下访问文件,将它们转移文档根目录之外是一种很好的方式来做到这一点。
Usually when you want to disallow access to files except under specific conditions, moving them outside the document root is a good way to do that.