Knowledge Base

¿Qué es esto?

Apache: Activar RewriteRules y htaccess

11/12/2013 - 14/03/2017 -  Comentarios - Apache

Mod rewrite tiene que estar acitvado (Suele venir activado en apache 2 o superior en los casos que me he encontrado hasta ahora).

Para que los ficheros .htaccess funcionen hay que añadir lo siguiente en la configuración de apache para cada directorio o virtual host correspondiente:

Options Includes

AllowOverride All

Order allow,deny

Allow from all

Para que se vea en conjunto ha quedado así en un SLES 10:

DocumentRoot "/srv/www/htdocs"

#

# Configure the DocumentRoot

#

<Directory "/srv/www/htdocs">

        # Possible values for the Options directive are "None", "All",

        # or any combination of:

        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

        #

        # Note that "MultiViews" must be named *explicitly* --- "Options All"

        # doesn't give it to you.

        #

        # The Options directive is both complicated and important.  Please see

        # http://httpd.apache.org/docs-2.2/mod/core.html#options

        # for more information.

        #Options None

        # AllowOverride controls what directives may be placed in .htaccess files.

        # It can be "All", "None", or any combination of the keywords:

        #   Options FileInfo AuthConfig Limit

        #AllowOverride None

        # Controls who can get stuff from this server.

        #Order allow,deny

        #Allow from all

        # 11/12/2013 - tnieto - Permitir las rewrite Rules. Se comenta todo lo de arriba

        Options Includes

        AllowOverride All

        Order allow,deny

        Allow from all

</Directory>