Problems with . htaccess on Lampstack

Asked

Viewed 40 times

1

I have the following problem.

I have a website that uses htaccess. I work locally on the website and it works normally, all redirects work perfectly. When I went up my application to the homologation server (an Amazon ec2 with Bitnami Lampstack) my redirects stopped working. It recognizes htaccess, works on some links, but doesn’t work the same as my local environment. Does anyone have any idea what it might be?

Follow the htaccess code

<IfModule mod_rewrite.c>
   RewriteEngine On

   #PAGINAS
   RewriteRule ^Paginas/(.*)/(.*)-([0-9]+)?$ Paginas.php?Codigo=$3 [L]

   #PROGRAMAS
   RewriteRule ^Programas/(.*)/(.*)-([0-9]+)?$ Programas.php?Codigo=$3 [L]

   #VIDEOS
   RewriteRule ^Videos/?$ Videos.php [L]

   #VIDEOS
   RewriteRule ^Videos/(.*)-([0-9]+)?$ VideosDetalhes.php?Codigo=$2 [L]

   #GALERIAS
   RewriteRule ^Galerias/?$ Galerias.php [L]
   RewriteRule ^Galerias/Categorias/(.*)-([0-9]+)?$ GaleriasCategorias.php?Codigo=$2 [L]
   RewriteRule ^Galerias/(.*)-([0-9]+)?$ GaleriasDetalhes.php?Codigo=$2 [L]

   #UNIDADES
   RewriteRule ^Unidades/?$ Unidades.php [L]
   RewriteRule ^Unidades/(.*)/(.*)-([0-9]+)?$ UnidadesDetalhes.php?Codigo=$3 [L]
   RewriteRule ^Unidades/(.*)/(.*)-([0-9]+)/retorno/?$ UnidadesDetalhesRetorno.php?Codigo=$3 [L]

   #NOTICIAS
   RewriteRule ^Noticias/?$ Noticias.php [L]
   RewriteRule ^Noticias/(.*)-([0-9]+)?$ NoticiasDetalhes.php?Codigo=$2 [L]

   #CONTATO
   RewriteRule ^Contato/?$ FaleConosco.php [L]

   #TRABALHE CONOSCO
   RewriteRule ^Trabalhe-Conosco/?$ TrabalheConosco.php [L]

   #DEPOIMENTOS
   RewriteRule ^Depoimentos/?$ Depoimentos.php [L]
   RewriteRule ^Depoimentos/(.*)-([0-9]+)?$ DepoimentosDetalhes.php?Codigo=$2 [L]

   #INTERCAMBIO BUSCA
   RewriteRule ^Intercambio/Busca/?$ DestinosBusca.php [L]

   #BUSCA
   RewriteRule ^Busca/?$ Busca.php [L]

   #INTERCAMBIO EM GRUPO
   RewriteRule ^Intercambio-em-Grupo/?$ Formulario1.php [L]

   #FILES AND DIRECTORIES
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule .* LinkSlug.php?Link=$0 [L]

</IfModule>
  • Post your . htaccess code for ease

  • you have root access to the server?

  • Yes @Rodrigoborth, I have

1 answer

2


Well, as it is with a specific server it is difficult to specify the problem, in a quick search on the web I found a similar case and the solution was the following

Create a file called rewrite.conf in /etc/apache2/mods-enabled in this file put the following line:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

After that restart apache: sudo service apache2 restart

Also you can add the following in your . htaccess RewriteBase /

I hope it works for you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.