How to access resources within application folder?

2019-09-10 09:46发布

问题:

First of all, I am fully aware that a better implementation, putting resources folder alongside application (not inside), exists. So yeah.

Resources = js, css, images.

This is just really a requirement, so any ideas how? I tried it but it says 403 (Forbidden).

回答1:

This is one of the possible solutions you can use

/applications
    /resources
      .htaccess
.htaccess

.htaccess of applications folder contains Deny from all

(it is CI default. which is the reason you get 403 Forbidden)

now make an .htaccess inside resources folder and keep it Allow from all

(so you are just allowing the resources folder to be accessible)