Running Apache 2.2 on CentOS 7

I have a bootstrap.min.css file:


It is version 2.2.1. However, when I go to http://example.com/css/bootstrap.min.css, I get a bootstrap file with version 3.1.1.

I've verified:

  • The file in the /css/ directory in the filesystem is 2.2.1 as expected
  • This is not a browser caching issue.
  • All other files in that folder work correctly...the bootstrap.css returns the correct file. It's only the bootstrap.min.css that doesn't work.

In short, apache is simply returning the wrong file, and I've never seen anything like this before. We've had 3 sets of eyes on this to confirm the problem.

We do have a single rewrite rule on the server:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^_router\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /_router.php [L]

However, this would result in a routing error if it were being used. So, it is not a rewrite issue.

  • Try putting another file in the CSS folder and testing whether or not that works, that will help narrow down the problem. – Tim Fountain Apr 21 '15 at 17:07
  • @TimFountain, we have lots of other files, they all work...but we found the problem, it was an apache .conf file...posting answer now. – Kevin Nelson Apr 21 '15 at 17:11

Solution: remove the /etc/httpd/conf.d/welcome.conf

The Apache welcome.conf file has some Alias values that affect the website and cause it to return files from the /usr/share/httpd/ directory instead of the site directory:

Alias /.noindex.html /usr/share/httpd/noindex/index.html
Alias /css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css
Alias /css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css
Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif
Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png

It was just pure coincidence that we happened to even have a bootstrap file with version 3.1.1 in our directories...and it explains why they were slightly different.

In any case, this means that anyone who uses the path /css/bootstrap.min.css on their website (very common setup) may have similar problems where the version they are expecting and the version the browser is getting are different.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.