Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess redirect css to php

I have multiple css files in a directory (style0.css, style1.css etc..) How can I redirect a request to these css files with htaccess so that a php can process the requested css file. ex. /styles/style0.css -> /includes/compressor.php?i=style0.css ?

like image 659
19greg96 Avatar asked May 14 '26 19:05

19greg96


1 Answers

Add an .htaccess to your css directory with these two lines. You can now add php code to your css files, and it will be processed :

AddHandler application/x-httpd-php .css

php_value default_mimetype "text/css"
like image 77
circusdei Avatar answered May 16 '26 10:05

circusdei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!