Css and js files are not loaded with multiple .htaccess slimframework


#1

well i have setup slim skeleton directly in public_html where in that directory their is first .htaccess file contain routing to public folder.
first .htaccess contain:

RewriteEngine On

RewriteBase /public/
RewriteRule ^$ public/

due to which my domain is directly pointing to public/index.php
which contain second .htaccess file with slimframework standard .htaccess file:

RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

Because of this my css and js files are not loaded inside template and they are going as in console

GET http://domain.com/css/bootstrap.min.css
returning 404 error
I am struugling with this issue from two days but still not able to get where should i change as its working fine on my local server but not over godaddy server.


#2

Where are your CSS and javascript files stored in relation to the public_html directory? Is it public_html/public/css/bootstrap.min.css?


#3

yes both are stored in inside public folder public/css and public/js.
But don’t mind i have fixed the issue by creating symlink to public folder


#4

Hi Antonio,

I have setup the slim skeleton in sub directory like document_root/api/

I’m able to access API through http://localhost/project/api/public/hello

But I want to access it like http://localhost/project/api/hello

Can you tell me what changes I have to make in .htaccess to make it work?

Thank You