G
G
Grigory Vasilkov2016-03-29 15:42:39
Apache HTTP Server
Grigory Vasilkov, 2016-03-29 15:42:39

How to change the extension from .js to .min.js in .htaccess with checking for file existence?

This is how it works for GZIP:

<FilesMatch "\.js$">
    RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule (.*)\.js$ $1\.js.gz [L]
    ForceType text/javascript
</FilesMatch>

I also wanted to do it for minification, but I hit my head on the fact that .min is in front of the extension, and checking it through
RewriteCond %{REQUEST_FILENAME}.min.js -f
Impossible .
The meaning of which, of course, I understand that you can redirect to get_minified.php and give out the desired file with the headers and check it - and so so as not to create unnecessary files through htaccess is this done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2016-03-29
@shambler81

RewriteCond %{ENV:REDIRECT_STATUS} 200

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question