/ / cPanel - .htaccessサブドメインを指す - .htaccess、zend-framework2、サブドメイン、cpanel、document-root

cPanel - .htaccessがサブドメインを指す - .htaccess、zend-framework2、サブドメイン、cpanel、ドキュメントルート

私は2つのドメインが同じホスティングを指しています。

domain_a.com そして、 domain_b.com

domain_b.com 実際にはのサブドメインを指しています domain_a.com (domain_b.domain_a.com)

ディレクトリ構造

public_html
|
|---- domain_a
|---- domain_b
|---- ...
|---- .htaccess

の内容 .htaccess

AddHandler application/x-httpd-php54 .php

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?domain_a.com$
RewriteCond %{REQUEST_URI} !^/domain_a/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /domain_a/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain_a.com$
RewriteRule ^(/)?$ domain_a/index.html [L]

しかし、私の domain_b.com 実際にはZendFramework 2を使用しています。 public

すなわち、

public_html
|
|---- domain_a
|---- domain_b
|---- public  <------ HERE
|---- ...
|---- .htaccess

最後に、私はこの結果を得ます

ここに画像の説明を入力

何か案が?

編集

# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?domain_a.com$
RewriteRule !^domain_a(/|$) /domain_a%{REQUEST_URI} [L,NC]

RewriteCond %{HTTP_HOST} ^(www.)?domain_b.com$
RewriteRule !^domain_b/public(/|$) /domain_b/public%{REQUEST_URI} [L,NC]

これはエラーを引き起こします Request exceeded the limit of 10 internal redirects due to probable configuration error. Use "LimitInternalRecursion" to increase the limit if necessary. Use "LogLevel debug" to get a backtrace.

domain_b/public また、 .htaccess ファイル。これはからデフォルトです Zend Framework 2

RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

回答:

回答№1は0

次のルールを試してください。

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteCond %{HTTP_HOST} ^(www.)?domain_a.com$
RewriteRule !^domain_a(/|$) /domain_a%{REQUEST_URI} [L,NC]

RewriteCond %{HTTP_HOST} ^(www.)?domain_b.com$
RewriteRule !^domain_b/public/index.php(/|$) /domain_b/public/index.php [L,NC]

回答№2の場合は0

サブドメインのパスをに設定してこれを解決します。 domain_b/public/ サブドメイン作成中

ここに画像の説明を入力