I have found a solution to this problem but it doesn't make sense to me and I'm hoping someone can explain it to me so I can understand.
I have wordpress installed on the root directory (/public_html/) for my website: domain.com - In this directory is a .htaccess which has the standard WP config but I have also added the following to redirect non-www to www:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
I have then setup a sub-domain: client.domain.com and set its root directory to /public_html/sites/client.domain.com/ - In this directory is another .htaccess which has I have added the following so that the site operates on http://client.domain.com/ and not http://www.domain.com/sites/client.domain.com/
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !client.domain.com$ [NC]
RewriteRule ^(.*)$ http://client.domain.com/$1 [L,R=301]
Now this works ok - I have index.html in the directory /public_html/sites/client.domain.com/ and when I type http://client.domain.com/ I get the right index.html.
BUT, here's my problem. I am trying to install Wordpress in /public_html/sites/client.domain.com/ (or on: http://client.domain.com/)
When I run the install:
Step 1: It asks for language - successfully select English
Step 2: It asks for database settings, I successfully enter the database details
Step 3: I get to page: http://client.domain.com/wp-admin/setup-config.php?step=2 which successfully displays:
All right, sunshine! You’ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to… [Run the Install]
Here is where it fails and I get this error page:
Forbidden
You don't have permission to access /wp-admin/install.php on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
on this URL: http://client.domain.com/wp-admin/install.php?language=en_AU
If I rename the /public_html/.htaccess the install works.
My question: how can the parent .htaccess overrule the local .htaccess?
And, why does it only happen when I get to Step 3? Why does it not cause problems prior to this step?