Css and Js Files Not Found on Production Server

The first post of this topic shows how I set my permission

And you did remove the vhost conf for http?

This is my htaccess:

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 ;)

I am not one of those… :P

Yeah, at these times I wish I WAS one of those! :D My http just has a permanent redirect to my http

<VirtualHost *:80>

	ServerAdmin webmaster@localhost

        ServerName test.example.com

        Redirect permanent / https://test.example.com


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.

I noticed just now that I have errors on my own site on local deploy, so if I figure it out, I will post here - if you are not beating me to it. :)

Apache… you are killing me!!! So I added the following line to my https config and now it works.

RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

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.

RewriteCond %{"REQUEST_FILENAME} !-f

RewriteCond %{"REQUEST_FILENAME} !-d



(I also agree that the Apache config is a kind of dark magic.)

Woo-hoo - I managed to do this myself too :lol:

First some global conf:

Listen 443


SSLPassPhraseDialog  builtin

SSLSessionCache    	"shmcb:/opt/lampp/logs/ssl_scache(512000)"

SSLSessionCacheTimeout  300

Virtual hosts:

<VirtualHost *:80>

	DocumentRoot "/home/jacmoe/webdev/vhosts/bugitor/frontend/web/"

	ServerName bugitor.dev

	<Directory "/home/jacmoe/webdev/vhosts/bugitor/frontend/web/">

    	AllowOverride All

    	Require all granted



<VirtualHost bugitor.dev:443> 

	DocumentRoot "/home/jacmoe/webdev/vhosts/bugitor/frontend/web/"

	ServerName bugitor.dev

	<Directory "/home/jacmoe/webdev/vhosts/bugitor/frontend/web/">

    	AllowOverride All 

    	Require all granted


	SSLEngine on 


	SSLCertificateFile "/opt/lampp/etc/ssl.crt/bugitor.dev.crt" 

	SSLCertificateKeyFile "/opt/lampp/etc/ssl.key/bugitor.dev.key" 

	SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire

	<FilesMatch "\.(cgi|shtml|pl|asp|php){:content:}quot;> 

    	SSLOptions +StdEnvVars 


	<Directory /usr/lib/cgi-bin>

                	SSLOptions +StdEnvVars


	BrowserMatch "MSIE [2-6]" \

                	nokeepalive ssl-unclean-shutdown \

                	downgrade-1.0 force-response-1.0

	BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown


I did not have to do magic for css and js, though…

And I created a self-signed certificate because localhost … ;)

Your magic must be on your htaccess file. I don’t see how you can get yii working without rewrite rules. :)

Not sure if I need this line:

SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire

However, I’ve had more than enough of the edit/restart/curse dance.

At least for now.

Yes, I prefer to keep them in htaccess because I find it easier to tweak/overlook.

Anyway, it is just a standard htacess, which I posted earlier :)

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

Yes, we don’t mess with Apache - at least not more than absolutely necessary, that’s for sure. ;)

i still am stuck here near you somewhere