Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 使用.htaccess阻止少数url_Regex_.htaccess_Url_Mod Rewrite_Block - Fatal编程技术网

Regex 使用.htaccess阻止少数url

Regex 使用.htaccess阻止少数url,regex,.htaccess,url,mod-rewrite,block,Regex,.htaccess,Url,Mod Rewrite,Block,我正在尝试使用.htaccess阻止几个URL 我正在.htaccess中尝试此代码,但它不起作用 RewriteEngine On RewriteCond %{THE_REQUEST} ^.*(wp-content)|(phpMyAdmin)|(mp4:).* [NC] RewriteRule ^(.*)$ - [F,L] 当我访问www.theawesomecoder.com/mp4.php时,它会被渲染,而不是显示禁止 我正在尝试阻止检查url中应该区分大小写的单词 如果有人输入mp4或

我正在尝试使用.htaccess阻止几个URL

我正在.htaccess中尝试此代码,但它不起作用

RewriteEngine On
RewriteCond %{THE_REQUEST} ^.*(wp-content)|(phpMyAdmin)|(mp4:).* [NC]
RewriteRule ^(.*)$ - [F,L]
当我访问www.theawesomecoder.com/mp4.php时,它会被渲染,而不是显示禁止

我正在尝试阻止检查url中应该区分大小写的单词

如果有人输入mp4或mp4,他们应该被禁止


请帮助

这是因为您的正则表达式是不正确的mp4:而不是mp4

简化正则表达式并确保DocumentRoot/.htaccess中的第一条规则:

RewriteEngine On

RewriteCond %{THE_REQUEST} (wp-content|phpMyAdmin|mp4) [NC]
RewriteRule ^ - [F,L]