Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda