TLDR; I had my code in a sub directory that was unable to find my stylesheet

Hi Windows Users on Xampp/mampp/lampp in 2019. I have a fix that worked for me that will work for you and it's to do with our environment setup. This was from a Laracasts Tutorial. PHP Practitioner

This was a breaking point for me and i made it over so you can too!

This is regarding both the errors where you copied jeffs code and still get a 404 OR you receive the error "Resource interpreted as Stylesheet but transferred with MIME type text/html".

First off, your .htaccess file should look like this:

RewriteEngine On
AddType text/css .css
AddType text/javascript .js
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteRule ^.*$ index.php [END]

Secondly all of your project files MUST 1000% go to your htdocs folder located at: C:\xampp\htdocs

Finally, if you are getting any more errors after this please email me at [email protected] and i will personally help you

Answer from Roman Ozerski on Stack Overflow
๐ŸŒ
Linux Questions
linuxquestions.org โ€บ questions โ€บ linux-software-2 โ€บ using-stylesheet-on-apache-server-247415
Using stylesheet on Apache-server?
Hi! I'm a newbie with apache, and I'm running Debian without any GUI. I'm using the default settings in apache, and my html-files are placed in /var/ww
Discussions

external css linked with html not working with apache server
Problem description External css not applyint styles to html on apache localhost Steps to reproduce both html and css are in same folder(/data/data/com.termux/files/usr/share/apache2/default-site/h... More on github.com
๐ŸŒ github.com
6
June 18, 2020
CSS not linking with Apache 2 Server - Raspberry Pi Forums
Wow thank you so much for the detailed response I really appreciate it. Helps me learn and fixed my problem. I'm all go for now - I just moved the CSS into the HTML file. I'll try the Apache config file at some stage too... for now I'm pretty keen to get going with the php side of my project. More on raspberrypi.org
๐ŸŒ raspberrypi.org
November 25, 2017
Updated to Apache 2.4 and now my style sheets do not load - Server Config - SitePoint Forums | Web Development & Design Community
Iโ€™ve configured Apache 2.4 exactly as the previous version, updated to PHP 8, but now no stylesheets are loading, just html. Using developer tools in Edge (and other browsers) I can apply the styles and everything looks fine. AddType text/css .css is included in my config file. More on sitepoint.com
๐ŸŒ sitepoint.com
0
July 24, 2023
apache - Enable PHP to read .css and .js files while keeping their original Content-Type - Stack Overflow
I would like to configure apache php5 in a way that .css and .js files will be inspected by php their content type will remain as default (that is respectively "text/css" and "application/x-javascr... More on stackoverflow.com
๐ŸŒ stackoverflow.com
June 23, 2010
๐ŸŒ
Ask Ubuntu
askubuntu.com โ€บ questions โ€บ 757305 โ€บ apache-2-4-7-doesnt-load-all-css-files
apache2 - Apache 2.4.7 doesn't load all .css files - Ask Ubuntu
Was using "StyleSheet.css" but when I renamed as "styles.css" it suddenly works! Running XAMPP on Windows 10. ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... End of Life Notice: Ubuntu 25.04 (Plucky Puffin) reached End of Life on... 2 Ubuntu 12.04 Apache 2 - Inline CSS working but external CSS not working
๐ŸŒ
Raspberry Pi Forums
forums.raspberrypi.com โ€บ board index โ€บ programming โ€บ general programming discussion
CSS not linking with Apache 2 Server - Raspberry Pi Forums
2. then go the /var/www and right click on the "www" folder then properties and i change the permission on "view content", "change content", and "access content" to allow "anyone" view content: anyone change content: anyone access content: anyone 3. restart apache2 server type: service apache2 restart 4. then test the webpage i hope this helps, it worked fine with me. ... Bad practice. Permissions are there for a reason. Also, replying to a two year old post is silly. ... Id rather put the stylesheet inside /var/www/html/style.css.
๐ŸŒ
GitHub
github.com โ€บ termux โ€บ termux-app โ€บ issues โ€บ 1608
external css linked with html not working with apache server ยท Issue #1608 ยท termux/termux-app
June 18, 2020 - both html and css are in same folder(/data/data/com.termux/files/usr/share/apache2/default-site/htdocs) apachectl start Html file ยท <html> <head> <link rel="stylesheet" type="text/css" href="http://localhost:8080/main.css" /> </head> <body> <h1> Chapter 1.</h1> <h1>Chapter 1.</h1> </body> </html> ... Also tried adding css mime type and enabling conf in httpd.conf and .htacces.
Author ย  tathastu871
๐ŸŒ
Apache
tapestry.apache.org โ€บ css.html
CSS - Apache Tapestry
For the above, your bootstrap.css file would be in your app's META-INF/assets/css folder. Apache Tapestry, Tapestry, Apache, the Apache feather logo, and the Apache Tapestry project logo are trademarks of The Apache Software Foundation.
Find elsewhere
๐ŸŒ
Nick Bettison
linickx.com โ€บ css-styling-apache-directory-listings
CSS Styling Apache Directory Listings. | Nick Bettison LINICKX.com
Apache 2.2 users also have IndexStyleSheet available, but since I'm using CentOS4 we'll do it this way. Finally you need the HeaderName, ReadmeName directives to tell Apache which file to look for (by default Apache looks for README.html, but that won't support SSI)...
Top answer
1 of 2
4

I think I see the problem. Your SetHandler is applying to every possible URL in the virtual host, without regard for whether it is a PHP file or not. Thus everything gets passed to PHP, even if it is a static file. And because PHP's interpreting the static file as PHP, you get the results you got.

You should instead send only requests for PHP files to the handler, by selecting them by filename:

        <FilesMatch \.php$>
            SetHandler "proxy:fcgi://127.0.0.1:9072"
        </FilesMatch>

You can then remove the unnecessary redundant <Files> bits that you had added.

2 of 2
1

The 403 error usually comes from a permission error. It could either be at the directory or the files level.

In your case, from what I can see (only the file and the apache doc root directory permissions), permissions seems fine.

Could you share with us the parents directories permissions? (it could be the /var/www/dev/ that have too restrictive permissions)

If the permissions aren't allowing "other", 0755 should do it...

chmod 0755 /var/www/dev

Also, /var/www/dev should belong to "dev-admin". If that isn't the case, I would suggest to change the ownership of it:

chown dev-admin: /var/www/dev

And @Michael Hampton is right. None of your changes were required (on a default CentOS 7 Apache configuration).

Ohh! Just to make sure that we are covering all the bases... Does dev-admin is the Apache user?

If not, you may either change it within the main Apache configuration or by changing the dev directory (recursive) with the proper user.

๐ŸŒ
SitePoint
sitepoint.com โ€บ server config
Updated to Apache 2.4 and now my style sheets do not load - Server Config - SitePoint Forums | Web Development & Design Community
July 24, 2023 - Iโ€™ve configured Apache 2.4 exactly as the previous version, updated to PHP 8, but now no stylesheets are loading, just html. Using developer tools in Edge (and other browsers) I can apply the styles and everything looks fine. AddType text/css .css ...
๐ŸŒ
sigmoid
npcglib.org โ€บ home โ€บ apache tip: custom css for your server status
apache tip: custom css for your server status - sigmoid
October 19, 2013 - apache2 -M | grep substitute or httpd -M | grep substitute ยท If you see a line with substitute_module, then youโ€™re good to go. If not see the documentation of your OS vendor on how to install it. Next configure your web server to do the substitution: <Location /server-status> SetHandler server-status # Add a line on the html head to include a CSS file, # instead of writing your CSS code as a substitution string
๐ŸŒ
PHP Freaks
forums.phpfreaks.com โ€บ web server administration โ€บ apache http server
[SOLVED] display correctly css files in apache2 - Apache HTTP Server - PHP Freaks
July 25, 2008 - Hi, I coded a website with html+php+mysql+apache2, everything works fine except that the css doesn't display, particulary the images and some other css classes, so, I tried to modify my apache2.conf adding this line: AddType text/css .css But still doesn't work Also, googling, I found that I can ...
๐ŸŒ
Server Fault
serverfault.com โ€บ questions โ€บ 589224 โ€บ apache-load-css-file-as-text-html
ubuntu 12.04 - apache load css file as text/html - Server Fault
April 15, 2014 - I think the real problem is that they're 404s. jiyihezi.net/memorybox-web/static/css/bootstrap.min.css jiyihezi.net/memorybox-web/static/css/all.css ... Then you've goofed something up in your configs. ... There are multiple reasons why this happens. For me, I mistakenly make apache to process css file as it does with php.
๐ŸŒ
Quora
quora.com โ€บ Why-wont-Apache-update-source-CSS-documents-when-I-reload-an-HTML-document
Why won't Apache update 'source' CSS documents when I reload an HTML document? - Quora
Answer (1 of 4): Because Apache never got the chance to do that. This is called cache and it is one of the various schemes to improve performance and reduce latency and bandwidth usage. In simpler terms, whenever you visit a website, Browser try to store the static information locally and when ...
๐ŸŒ
Htmlhelp
forums.htmlhelp.com โ€บ index.php
Where to put css files? - HTMLHelp Forums
August 3, 2011 - HTMLHelp.com | HTML Reference | CSS Reference | FAQs | Validator ยท Forums | Rules | Members | Search | Help