简体   繁体   中英

How to config .htaccess HTTP_REFERER in php?

in .htaccess I using code:

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?

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]

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