Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

apache - how to check an exact match when checking the referer header in .htaccess

I know similar questions have been asked before but I haven't been able to implement any of them successfully. I also know the security implications of using the referer header but i'm okay with that.

I have a webpage and a directory

page1.php

/content/all_of_my_content_files

I'm using iframes to access everything in the content directory but I would only like this content accessible from page1.php (no other page should be able to access this directory)

I've read the easiest way to do this is to use .htaccess in that directory to check the http_referer, except I'm not to sure on how to do this.

Essentially what I would like is to check if the http_referer exactly matches the url of page1.php and if it doesn't to redirect back to page1.php (there are security checks on page1.php that validates the user is logged in)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...