开发者

Allow Only Selected Domains to Access Certain Pages

I figure this can be accomplished with htaccess but I'm not sure how. Third-party payment processors for our site has a generic response handler that determines the payment method to process. Responses from these payment processor are passed via POST/GET after a redirect from their server. This gives us the burden to ensure that the data passed to our response handler indeed originated from a valid payment processor site. How I accomplish this using htaccess? BTW, I'm using PHP if in case htaccess is not enough for the solution.

Note: This is how the response handler URL looks like

http://w开发者_C百科ww.mydomain.com/seo-something-something-payment-callback.html?foo=bar&winnie=thefoo

or a POST equivalent.

Thanks in advanced.


If the IP address is constant, you can simply create a section in .htaccess and only allow the given IPs/subnets to access the contents, e.g.

<Directory "/some/dir">
Order Deny, Allow
Deny from All
Allow from 1.2.3.4
</Directory>

Otherwise, you could just check for $_SERVER['REMOTE_ADDR'] variable and compare with the valid address.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜