2012-03-23 10 views
5

Necesito redirigir direcciones URL particulares en un subdominio a URL completamente diferentes en un subdominio diferente. Por ejemplo:¿Cómo puedo 301 redirigir direcciones URL de subdominio específicas utilizando .htaccess?

http://foo.example.com/this-is-my-page 

necesita 301 a:

http://bar.example.com/this-is-really-my-page 

He tratado de establecer una sencilla Redirect 301 en .htaccess pero no parece funcionar. Por ejemplo:

Redirect 301 http://foo.example.com/this-is-my-page http://bar.example.com/this-is-really-my-page 
+0

probablemente tiene que estar en otro lugar en la configuración de Apache. ¿En qué sistema operativo estás? –

Respuesta

2

Esto es lo que terminé haciendo:

# first re-write all foo.example.com requests to bar.example.com 
RewriteCond %{HTTP_HOST} ^foo\.example\.com [NC] 
RewriteRule (.*) http://bar.example.com/$1 [L,R=301] 

# now re-write each individual URL 
RewriteRule ^this-is-mypage /this-is-really-my-page [NC,L,R=301] 
3

probar esto:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^sub\.domain\.com$ [NC] 
RewriteRule ^(.*) http://newsub.domain.com/ [L,R] 

funciona en mi lado

0

si quieres algo como esto:

http://foo.example.com/this-is-my-page 

a

http://bar.example.com/this-is-really-my-page 

pero http://foo.example.com/mypage tienen que responder sin redirección

Es posible ??

Beacause que:

# first re-write all foo.example.com requests to bar.example.com 
RewriteCond %{HTTP_HOST} ^foo\.example\.com [NC] 
RewriteRule (.*) http://bar.example.com/$1 [L,R=301] 

# now re-write each individual URL 
RewriteRule ^this-is-mypage /this-is-really-my-page [NC,L,R=301] 

no trabajando

Cuestiones relacionadas