0

I have cPanelA with website A...with subdomain A1 - all is working correctly.

I have created a new cPanelB with website B...and need to move subdomain A1 over to cPanel B as subdomain B1.

Website B is working...but after copying all of subdomain A1 over to cPanel B, I can't get subdomain B1 to work. It keeps returning Forbidden - you don't have permission to access this resource

In cPanelB, I have verified all the file/directory ownerships are correct. I verified all the file permissions are correct (0644 on files and 0755 on directories). I verified PHP is enabled for the new cPanel (via WHM). After more than an hour of frustration - I then verified subdomain B1 file structure/permissions/ownership were identical to those on subdomain A1.

I copied the .htaccess files from website A and subdomain A1 over to website B and subdomain B - and then changed any domain references to the new B sub/domain. So I don't think its my .htaccess files...they actually seem to be working because the root /www/.htaccess file has a rewrite to point to the subdomain folder /www/club and I can see in the browser that its actually making it to the subdomain B.

I know this is probably going to be something tedious but I am all out of ideas on what the issue could be.

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 for: 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
  • does cpanel provides detailed apache httpd error logs ? If so share here. How did you copied directories. Did you zip it with cpanel itself and then shifted to another cpanel. You should check directory ownership rather than permission. I don't know how cpanel manages vhosts, but you should check that too. – Sagar Sep 25 at 7:00
0

Well, I figured it out. Woke up this morning with hunch and turns out that was the issue.

RewriteRule ^ -  [F]

This line forces a 403 Forbidden error. I had this same .htaccess file applied to api.domainA.com and copied it over to api.domainB.com which too was correct. But also copied the api.domainB.com .htaccess file to portal.domainB.com and that subdomain requires user login, but the [F] was preventing the login page from coming up.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.