문제

I want to restrict access to direct folder in WHM, for example I have my website: samplesite.com

But at the same time if I open server-whm.com/~samplesite, I can see the content of my website.

I need to restrict this access to open my website only from the domain.

도움이 되었습니까?

해결책

You can place this rule as first rule in samplesite/.htaccess:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^(www\.)?samplesite\.com$ [NC]
RewriteRule ^ - [F]

This will allow /samplesite/ to be accessed only from samplesite.com

다른 팁

You can disable this functionality from WHM:

  1. login as root
  2. go to security center > Apache mod-userdir tweak
  3. tick the enable mod_userdir protection box
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top