금지된 리소스 권한을 얻어서 Apache 서버의 하위 도메인을 탐색할 수 없습니다.

금지된 리소스 권한을 얻어서 Apache 서버의 하위 도메인을 탐색할 수 없습니다.

웹사이트 A와 하위 도메인 A1이 있는 cPanelA가 있습니다. 모두 올바르게 작동합니다.

웹사이트 B를 사용하여 새 cPanelB를 만들었고 하위 도메인 A1을 하위 도메인 B1인 cPanel B로 이동해야 합니다.

웹사이트 B는 작동하지만...하위 도메인 A1을 모두 cPanel B로 복사한 후에는 하위 도메인 B1을 작동시킬 수 없습니다. 계속 돌아오네요Forbidden - you don't have permission to access this resource

cPanelB에서 모든 파일/디렉토리 소유권이 올바른지 확인했습니다. 모든 파일 권한이 올바른지 확인했습니다(파일의 경우 0644, 디렉터리의 경우 0755). WHM을 통해 새 cPanel에 PHP가 활성화되어 있음을 확인했습니다. 한 시간 이상의 좌절 끝에 저는 하위 도메인 B1 파일 구조/권한/소유권이 하위 도메인 A1의 파일 구조와 동일하다는 것을 확인했습니다.

.htaccess 파일을 웹사이트 A 및 하위 도메인 A1에서 웹사이트 B 및 하위 도메인 B로 복사한 다음 모든 도메인 참조를 새 B 하위/도메인으로 변경했습니다. 그래서 내 .htaccess 파일은 아닌 것 같습니다. 루트 /www/.htaccess파일이 하위 도메인 폴더를 가리키도록 다시 작성되었고 /www/club브라우저에서 실제로 하위 도메인 B로 연결되는 것을 볼 수 있기 때문에 실제로 작동하는 것 같습니다.

나는 이것이 아마도 지루한 일이 될 것이라는 것을 알고 있지만 문제가 무엇인지에 대한 아이디어가 모두 부족합니다.

www/.htaccess:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_HOST} ^api\. [NC]
RewriteRule !^api/ api%{REQUEST_URI} [L,NC]  // api.domainB.com
RewriteCond %{HTTP_HOST} ^portal\. [NC]      // portal.domainB.com
RewriteRule !^club/ portal%{REQUEST_URI} [L,NC]

Options -Indexes

SetEnvIf X-Rquested-With com.domainB domainB

#AddType application/x-httpd-php7 .html .htm

ErrorDocument 404 https://www.domainB.com/errorpage.html

# file upload info

DirectoryIndex index.html index.htm index.php
AddHandler application/x-httpd-ea-php73 .php .html .htm .phtml

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

www/club/.htaccess: Portal.domainB.com

RewriteEngine On

RewriteCond %{HTTP_HOST} !^portal\. [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule ^ -  [F]

#AddType application/x-httpd-php5 .html .htm

DirectoryIndex index.html index.htm index.php

Header set Access-Control-Allow-Origin "*"
AddHandler application/x-httpd-ea-php73 .php .html .php7 .phtml
ErrorDocument 404 https://portal.domainB.com/errorpage.html

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml .html
</IfModule>
# php -- END cPanel-generated handler, do not edit

답변1

글쎄, 알아 냈어. 오늘 아침에 일어나서 직감적으로 그게 문제였다는 것을 알게 되었습니다.

RewriteRule ^ -  [F]

이 줄은 403 Forbidden오류를 발생시킵니다. api.domainA.com에 동일한 .htaccess 파일을 적용하고 이를 api.domainB.com에 복사했는데 역시 정확했습니다. 또한 api.domainB.com .htaccess 파일을 Portal.domainB.com에 복사했고 해당 하위 도메인에 사용자 로그인이 필요했지만 이로 인해 [F]로그인 페이지가 나타나지 않았습니다.

관련 정보