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?
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">
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