Foros del Web » Administración de Sistemas » Software para Servers »

Hacer redireccion 301 para mi web

Estas en el tema de Hacer redireccion 301 para mi web en el foro de Software para Servers en Foros del Web. En la web que tengo actualmente, se puede entrar: miweb.com o www.miweb.com y como solo quiero que se entre www.miweb.com quiero hacer una redireccion 301 ...
  #1 (permalink)  
Antiguo 16/11/2010, 11:55
Avatar de victor5atodogas  
Fecha de Ingreso: junio-2010
Mensajes: 447
Antigüedad: 13 años, 10 meses
Puntos: 2
Hacer redireccion 301 para mi web

En la web que tengo actualmente, se puede entrar:

miweb.com
o www.miweb.com

y como solo quiero que se entre www.miweb.com quiero hacer una redireccion 301 desde .htacces

Actualmente el contenido de mi .htacces es:

Código:
##
# @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
# @package Joomla
# @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

#####################################################
#  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

# RewriteBase /

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section


RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Tambien lo he probado a traves de CPanel y no lo he conseguido


¿Alguno sabeis que tengo que modificar o añadir?

Muchas gacias y un saludo
  #2 (permalink)  
Antiguo 16/11/2010, 12:43
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Hacer redireccion 301 para mi web

No estoy seguro porque habria que analizar como afecta el resto de todo tu htaccess, pero proba cambiar

RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

x

RewriteCond %{HTTP_HOST} !^www.tudominio.com$
RewriteRule ^(.*)$ http://www.tudominio.com/$1 [R=301]

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #3 (permalink)  
Antiguo 16/11/2010, 12:49
Avatar de victor5atodogas  
Fecha de Ingreso: junio-2010
Mensajes: 447
Antigüedad: 13 años, 10 meses
Puntos: 2
Respuesta: Hacer redireccion 301 para mi web

He probado a cambiar eso pero no funciona

¿Alguna ota idea?
  #4 (permalink)  
Antiguo 16/11/2010, 13:04
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Hacer redireccion 301 para mi web

Intenta ponerla al inicio de todo a continuacion de tu
RewriteEngine On


si asi tampoco funciona, anda probando, de quitar el resto de las reglas, salvo el Options +FollowSymLinks que es requerido para modeRewrite

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #5 (permalink)  
Antiguo 16/11/2010, 13:06
Avatar de JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 2 meses
Puntos: 772
Hola victor5atodogas

Muevo tu tema al foro de Servidores Web desde Web general.

Saludos,
  #6 (permalink)  
Antiguo 16/11/2010, 15:15
Avatar de victor5atodogas  
Fecha de Ingreso: junio-2010
Mensajes: 447
Antigüedad: 13 años, 10 meses
Puntos: 2
Respuesta: Hacer redireccion 301 para mi web

Muchas gracias, ha funcionado perfectamente

Etiquetas: servidores, redireccionar
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:59.