Cannot make a cache safe URL for filename, file not found. Please verify that the file exists under the layouts directory

In this SharePoint tutorial, we will discuss how to resolve Cannot make a cache safe URL for filename, file not found. Please verify that the file exists under the layouts directory error which comes in SharePoint 2010.

Recently while working with SharePoint 2010. I was trying to giving a path to jQuery files using SharePoint designer, but it gave an error. The full error message is Cannot make a cache safe URL for “1033/http://siteurl/scripts/jquery-1.6.2.min.js”, file not found. Please verify that the file exists under the layouts directory.

I have created a folder inside SharePoint Style Library and putting all my .js files inside that directory. Now when I am giving the full path I am getting that error.

Cannot make a cache safe URL for filename, file not found SharePoint

There are different solutions for this, some might work and some might not work for your problem.

  • Check whether the file exists in the physical folder or not. If not presented there you can put there and check.
  • Sometimes you will get the error as “Cannot make a cache safe URL for “1033/sp.debug.js”, file not found. Please verify that the file exists under the layouts directory. ” For this, you can copy the sp.debug.js file and put it inside C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033.
  • Another solution is you can add Localizable = false attribute to SharePoint:ScriptLink like below:
<SharePoint:ScriptLink language="javascript" name="/foldername/JS/newjsfile.js" Localizable = false runat="server"/>
  • Apart from this, you can also give file path simply using script tag like below (provided file should be deployed inside StyleLibrary):
<script src="/Style%20Library/foldername/scripts/slides.min.jquery.js"type="text/javascript"> </script>

The above solution works for me and I put all the js files inside the Style Library folder in the SharePoint site.

You may like following SharePoint tutorials:

I hope this SharePoint tutorial helps to resolve error Cannot make a cache safe URL for filename, file not found. Please verify that the file exists under the layouts directory.

>