CodeIgniter Forums
cannot access file in root of project - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: Model-View-Controller (
+--- Thread: cannot access file in root of project (/showthread.php?tid=70758)

cannot access file in root of project - majortom84 - 05-26-2018

I am trying to get the access to a js file that has to be in root for it to work.


How can I reach this file? 

JS calling the script:
var _settings = {
    'service-worker-url': '/upup.sw.js'

htaccess in root: 
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 

Options FollowSymLinks MultiViews
   AllowOverride All
   Require all granted

Where Should I Place My Files?
For security reasons, the browser only lets UpUp's service worker see network requests within its scope.

The scope that the service worker can affect is determined by where you placed upup.min.js and upup.sw.min.js. For example, if you place it on, UpUp will only be able to show your offline content when users try to look at the /js/ directory.

This is why it is important to place both files on the same server as your content, and not in a subdirectory. This should idealy be in the root of your site (e.g.