Showing results for 
Search instead for 
Did you mean: 

css/js files inaccessible when moving web site to new server


css/js files inaccessible when moving web site to new server


I am in the process of moving a Magento CE web site from Windows Server 2003 where it operates well to Windows Server 2012/IIS 8.5. .While the new site displays product info (not product images), there are no styles and JavaScript functions don't work. This is because files in /media/js and /media/css under our Magento store folder yield 404 errors.  Buttons needing js in the admin for buttons like Save do not work so I have to make config changes in the database. 


Solution attempts/debugging:

I have seen a number of articles on inaccessible css/js files and have tried what they suggested to no avail. Here' what we've tried:

  1.  Checked site secure and unsecure urls in core-config table and they are correct and have trailing slashes
  2. Turned off css and js merging
  3. .htaccess file in media and root folders deleted. I don't think htaccess works on Win2K12 and we have put all our rewrites in web.config files using Microsoft Url Rewrite.  We are logging rewrite errors and seeing none there nor in the IIS web server logs other than the 404 errors.
  4. Turned off compilation
  5. Cleared cache and sessions in /var/cache and /var/session
  6. Deleted tmp files in /tmp,//var and /var/tmp
  7. Stopped and restarted web site.
  8. Cleared browser cache and restarted browser
  9. Checked the media folder permissions are the same as the working site we are moving from so that merged files can be written.  In any case when merging is on, I can see the js and css merge files in their correct directories under /media.

I tried putting a test html "Hello World" file in /media/css directory and I also got a 404.  Actually it redirects to the home page with a 404 title as expected because of the cms settings in the system. I do see the visit to the test page in the visitor logs in the Magento db.



Does anyone have any ideas for solving this problem?  Is there anything in the db or in config.xml files that I would need to edit when changing web servers and web server accounts?  Note that the new site uses the exact same domain and paths and both the web site files and database have been coped to the new site. I believe that php.ini is the same on both old and new servers.




Steve Shier

Tags (1)

Re: css/js files inaccessible when moving web site to new server

Problem solved.  There was a rewrite rule causing this.  The rule had no error so it wasn't showing up in the error log.  It was causing problems when the /media directory was accessed.