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

258
Vistas
Redirect to a subdirectory with .htaccess

I'm following a tutorial and I have a redirect problem.

I'm running ubuntu 16.04.

The project file is located in the /var/www/html directory and is named tuto

My directory tuto has the following directories: /controller, /view, /model, /core and webroot and as file it has index.php and .htaccess

The webroot directory has the following directories: /css, /img, /js and as index.php file

I would like that, when this url: //localhost/tuto/css/style.css is entered, that the .htaccess file will look it up in the webroot/css/style.css

How do I code this?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You should simply redirect that specific file in the htaccess file. i assume you have in it few redirections so put it before all of them:

RewriteEngine On

RewriteRule ^css/style.css webroot/css/style.css [QSA,NC]

and in your html code just call it as:

<link rel="stylesheet" href="css/style.css">
over 4 years ago · Santiago Trujillo Denunciar

0

You could do what they've suggested, it might make conflicts with your other htaccess rewrite rules. i would just go simple and do

RewriteEngine On

RewriteRule ^css webroot/css [QSA,NC]
RewriteRule ^js webroot/js [QSA,NC]

then every link to the css/js folders will actually call webroot folder

over 4 years ago · Santiago Trujillo Denunciar
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