The system can support CSS,JS multiple loads

Source: Internet
Author: User

We often see large web sites that support comma-delimited css,js loading, such as:

<link type= "Text/css" rel= stylesheet "href=" http://s.juancdn.com/juanpi/css/?? base.css,globale.css,md-business.css,pg-enroll.css,pg-manage.css,pg-my-account.css,alert.css?ts=1234 "/>

<script src= "http://s.juancdn.com/common/js/?" jquery.min.js,base.js?ts=1234 "></script>
The following solutions are shown:

1, modify Apache configuration file httpd.conf and restart, such as the following established s.juancdn.com binding and support rewrite

<virtualhost *:80>
DocumentRoot "D:/wamp/www/static"
ServerName s.juancdn.com
<directory "D:/wamp/www/static" >
AllowOverride All
Order Allow,deny
Allow from all
</Directory>
</VirtualHost>

2, root directory Add. htaccess

<ifmodule mod_rewrite.c>
Rewriteengine on
Rewritecond%{request_filename}!-f
Rewritecond%{query_string} ^ (. +) $
Rewriterule ^ (. *)/index.php [qsa,pt,l]
</IfModule>

3, the establishment of the import file index.php

<?php
$r = $_server[' Request_uri '];
Preg_match_all ("/\/" (. *?) \/?\?\? (.*?) (\?. *)/", $r, $matches);
if (!empty ($matches) &&!empty ($matches [1][0]) &&!empty ($matches [2][0])) {
$_get[' B '] = $matches [1][0];
$_get[' f '] = $matches [2][0];
}else{
Die ("Bad Request");
}
if (!empty ($matches) &&!empty ($matches [3][0])) {
Parse_str ($matches [3][0]);
}
Include_once ("min/index.php");

4, modify the configuration file min/config.php

Modify the following row of arguments to an existing address:

$min _cachepath = ' c:\\windows\\temp ';

5, modify the program's configuration file conf/test.php "This does not know need not"

Join:

'. css? ' => '. css ',//front-end static file path
'. js? ' => '. js ',//front-end static file path

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.