Google Project Minfiy is placed under the site root directory/min/.
If it is a formal environment (judging the condition, the domain name Http_host exists. The dot is judged to be the official on-line environment), then does not rewrite the website CSS js to min/index.php
If it is a test environment (judging the condition, the domain name Http_host does not exist.), or 192.168. Beginning or other special case, there is a special case), then the web site of Css/js Real files are all rewritten.
and the limited rewrite CSS JS is only the css/js! in the/public/public/css/js folder
Implementation code: htaccess, only support Apache server:
#if the formal environment, do not rewrite to the compressionRewritecond%{http_host}!\. [NC]Rewritecond%{request_filename} (\. ( JS|CSS)) $ [NC]Rewriterule^ ((css|js|public) \/.*\. ( CSS|JS) $ min/index.php?f=$1 [L,NE,NC]#formal environment, access/minDirectory JumpRewritecond%{http_host} \. [NC]Rewritecond%{request_filename}-FRewriterule^ (min\/.*) $/?=$1 [l,r=301]
If there is a problem, or if there are better suggestions, please communicate. by [email protected]
——————————————— additional ———————————————————
Modify the/min/.htaccess file if it is a formal environment, prohibit any access!
<Ifmodulemod_rewrite.c>Rewriteengine on# need rewritebase on some servers#RewriteBase/min#formal environment, no accessminfolder any Content! Rewritecond%{http_host} \. [NC] Rewriterule^ (. *) $/?f=$1 [l,r=301]# rewrite URLs like "/min/f= ..." to "/min/?f= ..."Rewriterule^ ([bfg]=.*) index.php?$1 [L,ne]</Ifmodule><Ifmodulemod_env.c># in case Addoutputfilterbytype have been addedSETENVNo-gzip</Ifmodule>
Apache htaccess minify Formal Environment no access to rewrite rules