如何使用.htaccess将两个域指向目录和子目录

时间:2015-10-08 06:24:57

标签: .htaccess

我有两个域www.domain2.comroot directory and its sub directory都有同一主机www.domain1.com中的文件。如何使用[root]www.domain2.com指向[root/sub/].htaccess到其子目录({{1}})。如果有人有任何想法,请分享

2 个答案:

答案 0 :(得分:0)

试试这个,

请在 www.domain1.com 网站.htaccess文件中使用以下

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.otherdomain1.com/$1 [R=301,L]

请使用以下 www.domain2.com 网站.htaccess文件

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.domain2.com/sub/$1 [R=301,L]

答案 1 :(得分:0)

在子目录中的.htaccess中使用此代码作为根目录:

array:90 [▼
      1 => array:5 [▼
                    "users_responsavel_id" => 2
                    "users_responsavel_nome" => "Freitas"
                    "users_responsavel_cgu_cpf" => "1185420"
                    "status" => 1
                    "numero_chave" => "13"
                   ]
      2 => 14
      4 => array:5 [▼
                    "users_responsavel_id" => 4
                    "users_responsavel_nome" => "Ana virgulina"
                    "users_responsavel_cgu_cpf" => "545687"
                    "status" => 1
                    "numero_chave" => "15"
                   ]
      6 => array:2 [▼
                    "chave_invalida_numero" => 16
                    "chave_invalida_status" => true
                   ]
      7 => 17
      8 => 18
      9 => 19
      11 => array:2 [▼
                     "chave_invalida_numero" => 20
                     "chave_invalida_status" => true
                    ]
      13 => array:2 [▼
                     "chave_invalida_numero" => 21
                     "chave_invalida_status" => true
                    ]
      22 => 26
      23 => 27
      24 => 28
      25 => 29
      26 => 30
     ]


<div class="card-deck" id="chaves_geradas">
                @foreach($b_c_d_c_a as $key => $value)
                    @if (is_array($value) || is_object($value))
                        @foreach ($value as $key_obj => $value_obj)
                            @if (in_array($key_obj == 'chave_invalida_numero', $value))
                            <div class="card mb-3 text-center card-inverse card-primary-transparent" style="line-height: 0;padding-top: 20px;padding-bottom: 5px;color: rgb(1, 255, 116);background-color: rgb(38, 50, 56);cursor: not-allowed;" data-toggle="tooltip" data-html="true" data-placement="top" title="Chave inválida.">
                                <div class="card-block">
                                    <span class="fa-stack" style="font-size: 45px;margin-top: -30px;margin-right: -20px;margin-bottom: -25px;x;margin-left: -20px;">
                                        <div class="fa-stack-1x" style="font-size: 65px;margin-top: -5px;">
                                        {{ $value_obj }}  
                                        </div>
                                    </span>
                                </div>
                            </div>
                            @elseif (in_array($key_obj == 'numero_chave', $value))
                            <div class="card mb-3 text-center card-inverse card-primary-transparent" style="line-height: 0;padding-top: 20px;padding-bottom: 5px;color: rgb(1, 255, 116);background-color: rgb(38, 50, 56);cursor: not-allowed;" data-toggle="tooltip" data-html="true" data-placement="top" title="Chave com usuário.">
                                <div class="card-block">
                                    <span class="fa-stack" style="font-size: 45px;margin-top: -30px;margin-right: -20px;margin-bottom: -25px;x;margin-left: -20px;">
                                        <div class="fa-stack-1x" style="font-size: 65px;margin-top: -5px;">
                                        {{ $value_obj }}
                                        </div>
                                    </span>
                                </div>
                            </div>
                            @endif
                        @endforeach

                    @else

                        <div class="card mb-3 text-center card-inverse card-primary-transparent" style="line-height: 0;padding-top: 20px;padding-bottom: 5px;">
                            <div class="card-block n_chaves" numero_chave="{{ $value }}">
                            <p style="font-size: 65px;">{{ $value }}</p>
                            </div>
                        </div>

                    @endif
                @endforeach
            </div>

您可以找到详细的文章here