I am getting a 404 error on my production site for js and css files. The files are getting written to the assets directory so I dont think its a permissions folder but the browser is giving me a 404 not found error for all js and css, whether they are in assets directory or on /js and /css directories.
On production server in webroot directory:
drwxr-xr-x 2 www-data www-data 4096 Feb 4 13:24 css
drwxr-xr-x 9 www-data www-data 4096 Feb 5 08:43 assets
-rw-r–r-- 1 www-data www-data 3041 Feb 4 13:24 site.css
Any help on getting these files to show on browser is greatly appreciated.
I found the issue but I do not know how to fix it. The problem is that I need this to be a secure site so its at https. How do I make yii know that the url needs to be https and not http? I have both apache configurations pointing to the same directory. The only difference between the configurations is that one is 443 so it goes to https. The http site works fine, but I can’t get the css and js files to show up on the https site.
The http site did not even exist when I was having this problem. I just created it temporarily while we test until I can get the https site working properly. Once I get the site to work I am just going to add a redirect on the http config. I need them both to be same url so that when person goes to http://example.com they will get redirected to https://example.com
@sofark: I have the same problem with your basic example. You are right. It has nothing to do with Yii. But I am failing to see what is wrong with the SSL configuration. Would you have an example SSL configuration that I could look at? I am pretty sure it is the mod rewrite section that I am failing in.
I finally got it. I had the redirect initially on my https config, but the css and js files were not being found. So I took the redirect out and created a configuration for http (port 80) and that worked out fine but only for the http site. I removed the http site and this time I put the redirect on an htaccess file instead, and voila! Everything works now! I still think that I should be able to redirect on the apache config file but at least now I have something that works
@jacmoe It is indeed a dark place for me! I managed to get the simple test site to show up with css, but not so much luck with the yii framework project. If anyone could take a look at my https configuration and help me get it right it would be greatly appreciated. I have followed the examples on yii framework site but I really don’t know enough about apache configuration. I now have the http redirecting to https site but still no css or js.
Yes. The files are physically present on the server. Some are on the asset folder created by yii and others are on the /css folder and /js folders themselves. They all get a 404 on the browser however. I don’t think its an issue with the actual certificate because I actually get a lock on the page, but I must be missing something on my apache configuration. This is my first time pushing a yii framework project to production. I have worked with zend framework before and I used to add a line on my config file to ignore css and js files from the rewrite condition. I don’t see that in the yii framework examples though so I’m guessing this is not needed.