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.
RewriteEngine on
# Redirect http to https
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
In ‘web’ directory.
Can’t help you with the actual vhost conf, as I am on Dreamhost where that has been managed for me.
Maybe you should ask on the Web Server section on StackExchange?
There are lots of really hard core Apache geeks there
This works fine with the test subdomain in which I just have a simple test page with a css file in a css directory. I see my stylesheet there and it applies it perfectly fine to my https:It’s just not working for yii framework. It seems to me like it’s trying to redirect css and js to the index page which would give me a 404 because they are not controller/action/views. What I don’t get is why it only does this on 443 and not on 80.
Why do I need to add that to my <VirtualHost *443> I have no clue, but it works for some odd reason. And why is this only an issue with 443 Virtual Hosts???
The following 2 lines should already prevent all existing files and directories from following the rewrite rule.
Ah yes! I wonder if moving my rewrite conditions to htaccess would have solved my problem as well. Well, I’m not messing with it now. Maybe for the next project. I will definitely keep that in mind though