Htaccess - redirecting the subdomain

4

I had the subdomain "b2b" .domain.com and now I have changed the files to the "catalog" .domain.com

I want an htaccess rule

When you enter the link

No matter what level it is

Be redirected to link

I think that if I create several rules htaccess one for each possible level of folder would solve, only I do not know the first one, to multiply

link

You have to go to link

as well as link

for link

Here is the rule that I think is the path

RewriteEngine on RewriteCond% {HTTP_HOST} ^ b2b.cellsystem.com.br [NC] RewriteRule ^ (. *) $ link $ 1 [L, R = 301]

edited:

support locaweb gave me this link

I'm going to try but I have not managed yet

edited: did not give

tentei redistribuir os arquivos index.php com o codigo em pastas com o nome de cada categoria e subcategoria, nao ta funcionando pq o produto é .html no final e nao index 

<?php
$server = $_SERVER['SERVER_NAME'];
$endereco = $_SERVER ['REQUEST_URI'];
header("Location: http://catalogo.cellsystem.com.br/{$endereco}");

but if someone knows the htaccess thank you

I will try to create file by html file in how much with redirect javascript

    
asked by anonymous 27.04.2016 / 02:47

1 answer

2

Creating a logic in the pages would not be the best practice for this case.

Use the .htaccess engine to simplify your process.

RewriteEngine On

RewriteCond %{HTTP_HOST} www.b2b.cellsystem.com.br

RewriteCond %{REQUEST_URI} !b2b/

RewriteRule ^(.*)$ http://catalogo.dominio.com.br/$1 [L]

So all access that goes to b2b will be redirected to catalog, without losing the parameters, at whatever level.

PS: take care that there is no conflict between the other directives of your .htacess

    
27.04.2016 / 04:30