High Performance Drop-in .htaccess File For Your Site

Discussion in 'Apache' started by anupdebnath, Jan 24, 2013.

  1. #1
    Just found a .htaccess solution to speed up website. Anyone use it before?https://github.com/sergeychernyshev/.htaccess
     
    anupdebnath, Jan 24, 2013 IP
  2. scylla

    scylla Notable Member

    Messages:
    1,025
    Likes Received:
    33
    Best Answers:
    1
    Trophy Points:
    225
    #2
    I've had a look at it & here's my thoughts. I'd like to get this part working with vbulletin 4.


    The problem is that during testing with it enabled it's not stripping the date from css files, also it would be good if it stripped the version number from js as well. Any suggestions to help get this working properly?

    # ----------------------------------------------------------------------
    # Enabling filename rewriting (file.XXX.ext) if URL rewriting is enabled
    # Otherwise URLs will use query strings (file.ext?v=XXX)
    #
    # More proxies cache assets if there is no query string
    # ----------------------------------------------------------------------
    <IfModule mod_rewrite.c>
       RewriteEngine On
     
       # Setting up an environment variable so your code can detect if mod_rewrite rules are executable
       # in this folder and you can use file.123.jpg or you need to fall back to file.jpg?123
       RewriteRule .                    -    [E=URLVERSIONREWRITE:YES]
     
       # Rewrites a version in file.123.jpg as well as timestamped version file.123_m_12345123512354.jpg
       # to original file.jpg so you can use it instead of file.jpg?123 which isn't cached in some proxies.
       RewriteCond %{REQUEST_FILENAME}            !-f
       RewriteRule ^(.*)\.(\d+)(_m_\d+)?\.([^\.]+)$    $1.$4    [L,QSA]
     
       # Rewrites a version in file.ac123fe.jpg to original file.jpg
       # so you can use it instead of file.jpg?123 which isn't cached in some proxies.
       # Used for hash-based URLs where having a timestamp is not necessary.
       RewriteCond %{REQUEST_FILENAME}            !-f
       RewriteRule ^(.*)\.([a-z\d]+)\.([^\.]+)$    $1.$3    [L,QSA]
    </IfModule>
    PHP:
     
    scylla, Jan 25, 2013 IP