html – CSS and htaccess | Content is appearing on page output.

the aim; Redirecting all CSS files to another director.

malfunction; I have an HTML page. <style> body{color:red} </style>. However, whenever I enable the .htaccess component, the style “body {color: red}” content is placed on the page without tags, still reddening the text.

.htaccess file:

<IfModule mod_rewrite.c>
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d 
 RewriteCond %{REQUEST_URI} .(css|css3) [NC]
 RewriteRule ^(.*).(.*) /css/$1.css [NC,L]
</IfModule>

.html file:

<!doctype html>
<html>
 <head>
  <meta charset="utf-8">
  <title>SiteName</title>
 </head>
 <body>
  <style>body{color:red}</style>
  <p>Hello World</p>
 </body>
</html>

Leave a Reply

Your email address will not be published.