-1

I am using a LAMP on Oracle Virtualbox. Everything was working great until I went into the /etc/apache2/sites-enabled/ and altered something in the Virtual Host file. I don't have a back up and I am not sure what I did. The documentRoot is being found and the index.php is being loaded. However, all of my CSS and Javascript files are returning a 404 so I basically get an unstyled page with text and images. All of my CSS and JS is located in /var/www/retirenetDev/retirenet/web/ where "web" is the document root, seen below. Everything is being correctly rewritten to index.php, but even the static css files?.

I'm just guessing by what I see in the access logs. I'm pretty sure the code I removed involved the Re-write. I removed a couple lines, then the site broke.

Here is my Virtual Host:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
        ServerName retirenet.dev
        DocumentRoot /var/www/retirenetDev/retirenet/web/
        <Directory />
            Options FollowSymLinks
            AllowOverride None
        </Directory>
        <Directory /var/www/retirenetDev/retirenet/web/>
         Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
        </Directory>
         RewriteEngine On
    RewriteCond $1 !^(fckeditor/)
    RewriteRule ^/(.*)$ /index.php/$1 [L]
    Alias /fckeditor "/home/open/retirenet/web/fckeditor/"
        AddOutputFilterByType DEFLATE text/html text/plain
        BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    CustomLog /var/log/apache2/access.log combined
    </VirtualHost>

And here is my apache access log when loading the page:

10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /c/fonts.x6x.css/ HTTP/1.1" 404 3228 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /s/jquery.scrollTo-1.4.0-min.js/ HTTP/1.1" 404 3228 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /i/spinner.gif HTTP/1.1" 301 380 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /s/jquery.serialScroll-1.2.1-min.js/ HTTP/1.1" 404 3228 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /i/top100_new.jpg HTTP/1.1" 301 383 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /i/close.gif HTTP/1.1" 301 378 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /i/spinner.gif/ HTTP/1.1" 404 3228 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /i/top100_new.jpg/ HTTP/1.1" 404 3228 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:33:34 -0500] "GET /i/close.gif/ HTTP/1.1" 404 3228 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
127.0.0.1 - - [20/Dec/2015:10:33:42 -0500] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET / HTTP/1.1" 200 14167 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /c/fonts.x6x.css HTTP/1.1" 301 383 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /s/jquery.center.js HTTP/1.1" 301 386 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /c/new_responsive.x6x.css HTTP/1.1" 301 392 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /c/fonts.x6x.css/ HTTP/1.1" 404 3228 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /c/style.x6x.css HTTP/1.1" 301 382 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /s/jquery-2.1.4.min.js HTTP/1.1" 301 389 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /c/listings.x6x.css HTTP/1.1" 301 386 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /s/retscripts.x7x.js HTTP/1.1" 301 386 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /c/listings.x6x.css/ HTTP/1.1" 404 3228 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
10.0.0.120 - - [20/Dec/2015:10:52:04 -0500] "GET /s/jquery.serialScroll-1.2.1-min.js HTTP/1.1" 301 401 "http://retirenet.dev/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 

Any idea as to what the issue could be? There are no errors in the apache error logs. The only errors I see are in my Firebug:

 "NetworkError: 404 Not Found - http://retirenet.dev/s/retscripts.x7x.js/"
/s/rets...x7x.js/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery.center.js/"
/s/jque...ter.js/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery.scrollTo-1.4.0-min.js/"
/s/jque...min.js/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery.serialScroll-1.2.1-min.js/"
/s/jque...min.js/
"NetworkError: 404 Not Found - http://retirenet.dev/i/top100_new.jpg/"
/i/top1...ew.jpg/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery.cookie.js/"
/s/jque...kie.js/
"NetworkError: 404 Not Found - http://retirenet.dev/i/spinner.gif/"
/i/spinner.gif/
"NetworkError: 404 Not Found - http://retirenet.dev/c/new_responsive.x6x.css/"
/c/new_...6x.css/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery-2.1.4.min.js/"
/s/jque...min.js/
"NetworkError: 404 Not Found - http://retirenet.dev/c/listings.x6x.css/"
/c/list...6x.css/
"NetworkError: 404 Not Found - http://retirenet.dev/c/fonts.x6x.css/"
/c/fonts.x6x.css/
"NetworkError: 404 Not Found - http://retirenet.dev/c/style.x6x.css/"
/c/style.x6x.css/
"NetworkError: 404 Not Found - http://retirenet.dev/i/close.gif/"
/i/close.gif/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery.center.js/"
/s/jque...ter.js/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery.scrollTo-1.4.0-min.js/"
/s/jque...min.js/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery.serialScroll-1.2.1-min.js/"
/s/jque...min.js/
"NetworkError: 404 Not Found - http://retirenet.dev/s/jquery.cookie.js/"
/s/jque...kie.js/
"NetworkError: 404 Not Found - http://retirenet.dev/s/retscripts.x7x.js/"

So basically, I can cruise the wesbite just fine. All data from DB is being loaded correctly. All pages are just unstyled and broken because JS & CSS is not loading. Thanks!

Update: Here is my new host virtual host file with updated conditional to re-write. Still the same. Not working:

<VirtualHost *:80>
    ServerName retirenet.dev
    DocumentRoot /var/www/retirenetDev/retirenet/web/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/retirenetDev/retirenet/web/>
        Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

    </Directory>

RewriteEngine On

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</VirtualHost>
NIMISHAN
  • 115
  • 5
Joe Stenhouse
  • 11
  • 1
  • 2
  • 1
    Presumably you had some RewriteCond that excluded the static files from rewrite. This would be a good time to restore the original file from backup. – Jenny D Dec 21 '15 at 09:44
  • Thank you Jenny. I agree. That's just it, I don't think I have a backup (per my comments in the thread). I never made a snap shot of the server from within Oracle Box or any other type of back up of the system files. I did however find the following rule written at the header of the index.php file in a COMMENT: # RewriteEngine On # RewriteCond $1 !^(i/|c/) # RewriteRule ^/(.*)$ /index.php/$1 [L] – Joe Stenhouse Dec 21 '15 at 09:59
  • I applied the extra conditional RewriteCond $1 !^(i/|c/) and it still doesn't work – Joe Stenhouse Dec 21 '15 at 10:00
  • The folders /i/ and /c/ are sub folders in the document root that hold the css and javascript. I believe that is what that conditional is trying to do...but with no luck – Joe Stenhouse Dec 21 '15 at 10:07
  • Turn on mod_rewrite logging. How to do that is also explained in the linked question. – Jenny D Dec 21 '15 at 11:07
  • Go to the page. Press Ctrl+F, search for "Log". – Jenny D Dec 21 '15 at 14:32
  • Create an answer and mark it as valid please. – Froggiz Dec 21 '15 at 16:01

1 Answers1

0

The answer to this question was the following line :

RewriteRule ^/(c|s)/(\w+)(.x[0-9]+x)(.css|.js)?$ /$1/$2$4 [L] 

This line deals with the re-write of my css and javscript files. I didn't realize that I was calling a constant for my css and js files in order to help the viewers get the latest version. I needed to set up a regex pattern for it. Here is an example of one of the references:

<link rel="stylesheet" type="text/css" href="/c/style.x<?=CSS_VER?>x.css" />
Joe Stenhouse
  • 11
  • 1
  • 2