简体   繁体   English

如何在PHP中配置.htaccess HTTP_REFERER?

[英]How to config .htaccess HTTP_REFERER in php?

in .htaccess I using code: 在.htaccess中,我使用代码:

RewriteEngine On 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?domain.com [NC]
RewriteRule !check.php http://www.domain.com/check.php?url=http://domain.com%{REQUEST_URI} [QSA]

All Url from domain.com will redirect to domain.com/check.php , But I want when access link domain.com/enter.php will not redirect to domain.com/check.php , How to fix it? 来自domain.com所有网址都将重定向到domain.com/check.php ,但是我想当访问链接domain.com/enter.php不会重定向到domain.com/check.php ,如何解决?

you can use this: 您可以使用此:

RewriteEngine On 
RewriteCond %{HTTP_REFERER} ^http(s)?://(www.)?domain.com [NC]
RewriteCond %{REQUEST_URI} !^/enter.php$
RewriteRule (.*) http://www.domain.com/check.php?url=http://domain.com%{REQUEST_URI} [QSA]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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