0

Codeigniter shows an 404 error page, for a javascript file. The file is in a js folder. The file in question is jquery.cookie.js.

If I change the filename, then I can access the file.

There are no route settings or .htaccess rules for the file, but for some reason codeigniter is showing its default 404 page when the javascript file is accessed.

8
  • are you able to access other files in the same folder? Commented Jun 18, 2012 at 8:58
  • @swapnesh Yes I am able to access all other files in the folder. Even if I change the filename, I am able to access the file,but not when the filename is jquery.cookie.js Commented Jun 18, 2012 at 9:45
  • @WebNovice.. can u plz tell me how ur navigating to these files? Commented Jun 18, 2012 at 9:55
  • @swapnesh I noticed the error when some jquery functions were not working on the site. So, I tried accessing the JS file directly with its URL, its showing me the CI 404 page. The js folder is located in the root folder. The folder does not contain any .htaccess or even an index.html file. When I go to www.mysite.com/js, it lists all the files including the problematic file, but when I click on it, it takes me to CI 404 page. It doesn't happen with the other files that are listed. Commented Jun 18, 2012 at 9:59
  • ..u can try by renaming your .htaccess file and let me know if it works or not Commented Jun 18, 2012 at 10:07

2 Answers 2

1

I've had this problem before - the problem stems from CI's well intentioned security system that looks for certain malicious strings. I never tracked down exactly where it does it, but if a JS file name contains ".cookie" it'll be denied by CI's internal filter.

The quick fix is to just rename the file to not include the word cookie, or change the . in the filename to a _.

Sign up to request clarification or add additional context in comments.

1 Comment

where does it say that codeigniter has a security system like that? If there is, CI should mention it. Wasted a lot of time looking for what caused it. I changed the filename to jquery.cookie1.js and it worked.
0

Ok, finally figured out what the problem was. Any file that has "cookie" in its filename was blocked by mod_security on our server.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.