Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

362
Vistas
Laravel remove public route AND disable it for accessing

I am using Laravel 7 within my last project. I used the same approach on all my Laravel projects to remove the 'public' from the route: - create a .htaccess within the root folder and add:

RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]

I agree, that this method is all around the google and also works locally. Everything perfect until here.

The problem is that I made a facebook ad campaign on this project which points to the homepage (/) of the website and also added a 'Book Now' button with a link to it. The strange thing is that the link from Facebook ad, points to mywebsite.com/public even I specified only mywebsite.com so I just tried to manual access that route with public, and it worked.

So looks like my website's homepage is / and /public/ in the same time. I want to be accessible only on / and disable the 'public'. Maybe if it's still specified, to be redirected to /. I also read about that kind of fix to rename 'server.php' to 'index.php' and copy the .htaccess from public to the root, but there are a lot of negative advices not to do this for security reasons.

What would be the proper and also secure way to achive this ?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda