Marius Prollak
Marius Prollak

Reputation: 368

Make website accessible only from specific domain

Is there any way (PHP) to make my website accessible only if opened from my domain ?

e.g if mydomain.com was navigated to, website should open, if it's any other domain the website should not open.

For whatever reason there's a lot of random domains pointing their A records to my server and I don't want my website opened if it's not through my domain.

Upvotes: 0

Views: 999

Answers (1)

SLaks
SLaks

Reputation: 888047

Just check whether the Host: header matches your domain and show an error if it doesn't.

Upvotes: 5

Related Questions