h1

Redireccionar todo a tráfico seguro / Invalid command ‘RewriteEngine’

20/07/2008

Si tras configurar un sitio con una redirección, por ejemplo uno que redireccione todo el tráfico http a https:

pilar002:/etc/apache2/sites-available# cat redir
NameVirtualHost *:80
RewriteEngine on
RewriteLog /var/log/apache2/https_rewrite.log
RewriteLogLevel 1
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]

Fuente: http://crysol.inf-cr.uclm.es/node/198

Se produce el siguiente error:

pilar002:/etc/apache2/sites-available# /etc/init.d/apache2 restart
Forcing reload of web server (apache2)...Syntax error on line 3 of /etc/apache2/sites-enabled/redir:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
failed!

La solución es tan sencilla como cargar el módulo de rewrite:
pilar002:/etc/apache2/mods-available# a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.

Advertisement

3 comentarios

  1. Muchisimas gracias ha sido de muchisima utilidad
    :)


  2. Gracias!!!! me ayudo mucho ! ! !


  3. Gracias por la solución, nunca habia instalado wampserver, pero me esta dando algún dolor de cabeza con este tipo de problemas.



Deja un comentario

Fill in your details below or click an icon to log in:

Gravatar
Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s

Seguir

Get every new post delivered to your Inbox.