我想阻止几个与 htaccess 文件中的正则表达式匹配的 URL。
这些是我想在 htaccess 中阻止的 URL。
URL 模式中包含以下内容的任何内容:
- mp4:
- wp-内容
- phpMyAdmin
不区分大小写,请注意“mp4:”必须包含冒号以匹配表达式。
我怎样才能做到这一点?
谢谢!
最佳答案
这应该有效:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^.*(wp-content)|(phpMyAdmin)|(mp4:).* [NC]
RewriteRule ^(.*)$ - [F,L]
然后,包含此类字符串的网址将显示禁止消息。例如:
You don't have permission to access /foomp4:bar/ on this server.
关于php - 使用正则表达式阻止 .htaccess 中的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17477460/