简体   繁体   中英

.htaccess block semalt with wildcard regex

I have the below rewrite rule to block semalt.com. It blocks all traffic referred by them (ie 1.semalt.com). Recently they create a new referrer url (semaltmedia.com). How can I modify the below code to block if they have a word before or after the word semalt with no space or period (ie semaltmedia.com)?

 RewriteCond %{HTTP_REFERER} semalt\.com [NC]

Try :

RewriteCond %{HTTP_REFERER} ^https?://(www\.)?.*semalt.*\.com [NC]
RewriteRule ^ - [F,L]

This returns a forbidden (403) message for a http referer of the following formats :

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM