Foros del Web » Administración de Sistemas » Apache »

[SOLUCIONADO] redireccionar sin www a www con error

Estas en el tema de redireccionar sin www a www con error en el foro de Apache en Foros del Web. Buenas, tengo un error persistente con .htacces Cuando tecleo en la barra de navegacion www.l2luna.com.ar el sitio carga correctamente pero cuando al .htacces le agrego ...
  #1 (permalink)  
Antiguo 10/12/2013, 19:05
Avatar de luzzifer  
Fecha de Ingreso: julio-2009
Ubicación: Paraná - Argentina
Mensajes: 169
Antigüedad: 14 años, 9 meses
Puntos: 3
Pregunta redireccionar sin www a www con error

Buenas, tengo un error persistente con .htacces
Cuando tecleo en la barra de navegacion www.l2luna.com.ar
el sitio carga correctamente
pero cuando al .htacces le agrego lo siguiente para que redireccione automaticamente si tener que teclear www.l2luna.com.ar o sea que si escribo l2luna.com.ar redireccione automaticamente con el siguiente codigo en el .htacces
Código .htacces:
Ver original
  1. RewriteEngine On
  2. RewriteCond %{HTTP_HOST} ^l2luna.com.ar
  3. RewriteRule (.*) http://www.l2luna.com.ar/$1 [R=301,L]

Y mi .htacces ahora esta sin ese codigo ya que si lo activo no se ve.
Código .htacces:
Ver original
  1. ##
  2. # @package      Joomla
  3. # @copyright    Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
  4. # @license      GNU General Public License version 2 or later; see LICENSE.txt
  5. ##
  6.  
  7. ##
  8. # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
  9. #
  10. # The line just below this section: 'Options +FollowSymLinks' may cause problems
  11. # with some server configurations.  It is required for use of mod_rewrite, but may already
  12. # be set by your server administrator in a way that dissallows changing it in
  13. # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
  14. # beginning of line), reload your site in your browser and test your sef url's.  If they work,
  15. # it has been set by your server administrator and you do not need it set here.
  16. ##
  17.  
  18. ## Can be commented out if causes errors, see notes above.
  19. Options +FollowSymLinks
  20.  
  21. ## Mod_rewrite in use.
  22.  
  23. RewriteEngine On
  24.  
  25.  
  26. ## Begin - Rewrite rules to block out some common exploits.
  27. # If you experience problems on your site block out the operations listed below
  28. # This attempts to block the most common type of exploit `attempts` to Joomla!
  29. #
  30. # Block out any script trying to base64_encode data within the URL.
  31. RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
  32. # Block out any script that includes a <script> tag in URL.
  33. RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
  34. # Block out any script trying to set a PHP GLOBALS variable via URL.
  35. RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
  36. # Block out any script trying to modify a _REQUEST variable via URL.
  37. RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
  38. # Return 403 Forbidden header and show the content of the root homepage
  39. RewriteRule .* index.php [F]
  40. #
  41. ## End - Rewrite rules to block out some common exploits.
  42.  
  43. ## Begin - Custom redirects
  44. #
  45. # If you need to redirect some pages, or set a canonical non-www to
  46. # www redirect (or vice versa), place that code here. Ensure those
  47. # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
  48. #
  49. ## End - Custom redirects
  50.  
  51. ##
  52. # Uncomment following line if your webserver's URL
  53. # is not directly related to physical file paths.
  54. # Update Your Joomla! Directory (just / for root).
  55. ##
  56.  
  57. # RewriteBase /
  58.  
  59. ## Begin - Joomla! core SEF Section.
  60. #
  61. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  62. #
  63. # If the requested path and file is not /index.php and the request
  64. # has not already been internally rewritten to the index.php script
  65. RewriteCond %{REQUEST_URI} !^/index\.php
  66. # and the request is for something within the component folder,
  67. # or for the site root, or for an extensionless URL, or the
  68. # requested URL ends with one of the listed extensions
  69. RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
  70. # and the requested path and file doesn't directly match a physical file
  71. RewriteCond %{REQUEST_FILENAME} !-f
  72. # and the requested path and file doesn't directly match a physical folder
  73. RewriteCond %{REQUEST_FILENAME} !-d
  74. # internally rewrite the request to the index.php script
  75. RewriteRule .* index.php [L]
  76. #
  77. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
  78. RewriteRule ^index\.html$ http://l2luna.com.ar/ [R=301,L]
  79. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
  80. RewriteRule ^index\.php$ http://l2luna.com.ar/ [R=301,L]
  81. #
  82. ## End - Joomla! core SEF Section.
  #2 (permalink)  
Antiguo 11/12/2013, 08:22
Colaborador
 
Fecha de Ingreso: septiembre-2013
Ubicación: España
Mensajes: 3.648
Antigüedad: 10 años, 7 meses
Puntos: 578
Respuesta: redireccionar sin www a www con error

Se te olvidó escapar los puntos compañero:

Código Apache:
Ver original
  1. RewriteEngine On
  2.  
  3. RewriteCond %{HTTP_HOST} ^l2luna\.com\.ar
  4.  
  5. RewriteRule (.*) http://www.l2luna.com.ar/$1 [R=301,L]

  #3 (permalink)  
Antiguo 11/12/2013, 09:13
Avatar de luzzifer  
Fecha de Ingreso: julio-2009
Ubicación: Paraná - Argentina
Mensajes: 169
Antigüedad: 14 años, 9 meses
Puntos: 3
Respuesta: redireccionar sin www a www con error

Muchisimas gracias PHPeros sos muy amable me funciono a la perfeccion. Muchas gracias

Etiquetas: 301, htaccess, html, ip, php, redireccion, redireccionar, url, www
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:18.