0

Tengo este código en .htaccess

<FilesMatch "(\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">
    Order allow, deny
    Deny from all
    Satisfy All
</FilesMatch>`

El problema es que sin ese código, me deja ingresar perfectamente al index.php, pero cuando lo coloco me aparece el problema.

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log.

Uso xampp con apache y mysql

Mi codigo php todavia no tiene nada, es solo un h1 con un texto random.

2
  • Será que no tienes el modulo headers de apache instalado, que es el que interpreta el FilesMatch segun parece.
    – masterguru
    el 10 mar. 2022 a las 9:32
  • Ese es todo el código que tienes en el .htacces?
    – Aleman
    el 11 mar. 2022 a las 14:38

1 respuesta 1

0

No se que intentas hacer con esa regla.

Pero si lo que quieres es no permitir que se pueda acceder a archivos con esas extensiones

Cambia

<FilesMatch "(\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">
    Order allow, deny
    Deny from all
    Satisfy All
</FilesMatch>`

Por

RewriteRule \.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp)$ index.php[NC,F,L]

Lo que hace este código es:

Cuando se intente acceder a cualquier archivo con la extensión incluida en la regla . Todas las solicitudes serán redireccionadas al index.php

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.