Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!