我正在使用此代码
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https://(subdomain\.)?domain\.com/ [NC]
RewriteCond %{REQUEST_URI} !hotlink\.(gif|png|jpg|jpeg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov|mp3) [NC]
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule .*\.(gif|png|jpg|jpeg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov|mp3)$ https://subdomain.domain.com/ [NC]
关于https://(subdomain\.)?domain\.com/
是正确的引用语法
http://subdomain.domain.com/
http://www.subdomain.domain.com/
https://subdomain.domain.com/
https://www.subdomain.domain.com/
答案 0 :(得分:0)
这应该做:
^https?://(www\.)?subdomain\.domain\.com/
说明:
的开头断言位置
^
在字符串
http
匹配字符http字面
s
- 字符匹配
?
- 量词,匹配0到1次之间的字符“s”
://
- 匹配字符://字面意思
www
- 匹配字符www字面
\.
- 匹配字符“。”字面意思
?
- 量词,匹配组“www。”在零到一次之间
subdomain
- 字面匹配字符“subdomain”
\.
- 匹配字符“。”字面意思
domain
- 字面匹配字符“domain”
\.
- 匹配字符“。”字面意思
com/
- 字面匹配字符“com /”
答案 1 :(得分:0)
你能否确认
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?subdomain\.domain\.com/ [NC]
RewriteCond %{REQUEST_URI} !hotlink\.(gif|png|jpg|jpeg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov|mp3) [NC]
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule .*\.(gif|png|jpg|jpeg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov|mp3)$ https://subdomain.domain.com/ [NC]
参考
http://subdomain.domain.com/
http://www.subdomain.domain.com/
https://subdomain.domain.com/
https://www.subdomain.domain.com/
?