Answer the question
In order to leave comments, you need to log in
How to properly configure .htaccess so that scripts, images, etc. loaded without 404?
Hello! I am writing a bike for a test task. In the conditions of the task, it is worth separating public files and application code. The application itself is almost completely written for me, only scripts and styles are not connected) Here is the structure:
When I access "some.site/src/css/bootstrap.min.css" I want the contents of the file "some.site/public/src" /css/bootstrap.min.css", but in fact I see 404.
AddDefaultCharset utf-8
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ public/index.php
RewriteRule ^src/(.*)$ public/src/$1 [L]
but it does not help.
Answer the question
In order to leave comments, you need to log in
classic
/.htaccess
RewriteEngine On
RewriteRule ^(.*)$ /public/$0
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?$0 [L]
/css/bootstrap.min.css
, etc. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question