使子域名使用主域文件

时间:2016-06-23 14:13:20

标签: apache .htaccess dns subdomain

我希望有人对此有所了解。

我有两个域名: domain.com cl.domain.com

cl.domain.com实际上是同一网站的西班牙语版本。两个域都使用相同的文件,CMS和数据库。

我们已经获得了一些代码,可根据所使用的域名将所有菜单和信息更改为西班牙语。

现在,当我输入" cl.domain.com"它重定向到" domain.com"。

这不是我们所需要的。我们需要将该网站保留在cl.domain.com上。

此外,当我点击西班牙语语言块以转到西班牙语网站时,我得到https://cl.domain.com/cgi-sys/defaultwebpage.cgi一个大的" SORRY"在顶部。

似乎htaccess文件可能存在问题,但我不确定。

这已经好了两年,但突然之间停了下来。

如何让cl.domain.com和domain.com使用相同的文件并停止重定向?如果他们转到该子域,人们应该留在cl.domain.com上,但是使用domain.com中的相同文件。

我认为问题出在htaccess的这一部分

<IfModule mod_rewrite.c>
  RewriteEngine on

  # Set "protossl" to "s" if we were accessed via https://.  This is used later
  # if you enable "www." stripping or enforcement, in order to ensure that
  # you don't bounce between http and https.
     RewriteCond %{HTTPS} off [OR]
     RewriteCond %{HTTP_HOST} ^www.domain\.com*
     RewriteRule ^(.*)$ https://domain.com/$1 [L,P]

  # Make sure Authorization HTTP header is available to PHP
  # even when running as CGI or FastCGI.
  RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  # Block access to "hidden" directories whose names begin with a period. This
  # includes directories used by version control systems such as Subversion or
  # Git to store control files. Files whose names begin with a period, as well
  # as the control files used by CVS, are protected by the FilesMatch directive
  # above.
  #
  # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  # not possible to block access to entire directories from .htaccess, because
  # <DirectoryMatch> is not allowed here.
  #
  # If you do not have mod_rewrite installed, you should remove these
  # directories from your webroot or otherwise protect them from being
  # downloaded.
  RewriteRule "(^|/)\." - [F]

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} .
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment the following:
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /

    RewriteCond %{HTTP_HOST} ^www\. [NC]
    RewriteCond %{HTTP_HOST} !^cl\.
    RewriteRule ^ https://cl.domain.com%{REQUEST_URI} [P]


  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

</IfModule>

0 个答案:

没有答案