GithubHelp home page GithubHelp logo

.htaccess's Introduction

Copy .htaccess file to your site to improve performance.

Contributing

If you'd like to help, just fork the repository, then add useful stuff and send a pull request.

http://github.com/sergeychernyshev/.htaccess/

Also, check out the issue tracker and take on some task or just vote for existing issues and submit your comments and suggestions.

.htaccess's People

Contributors

coornail avatar kiphughes avatar nhoizey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

.htaccess's Issues

Gzip rules are not perfect

gzip rules are pretty much outdated and gzip inclusion need to be changed to include more formats and maybe use whitelisting instead of blacklisting.

See comments from Stoyan:
http://www.sergeychernyshev.com/blog/speed-up-your-site-drop-in-htaccess-file/comment-page-1/#comment-17451

and Paul:
http://www.sergeychernyshev.com/blog/speed-up-your-site-drop-in-htaccess-file/comment-page-1/#comment-17715

Paul also has similar file in html5 boilerplate project - good place to borrow some rules:
http://github.com/paulirish/html5-boilerplate/blob/master/.htaccess

Should this be merged into HTML5Boilerplate?

This project might be redundant considering that HTML5Boilerplate is pretty well maintained.

Should we merge it into there / cancel this project?

Please leave your opinion in the comments.

Strip date and version number from vbulletin 4 js & css files.

Ok, I've had a look at it & here's my thoughts. I'd like to get this part working with vbulletin 4.
Here is how the files look after vbulletin processes them.
/forum/clientscript/vbulletin-core.js?v=420
/forum/clientscript/vbulletin_css/style00021l/additional.css?d=1358449816

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

----------------------------------------------------------------------

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]

Define proper MIME types for all files

Maybe it would be better to add these lines from HMLT5Boilerplate to make sure the MIME types used in the ExpireByType (some would need to be updated) are the good ones :

# ----------------------------------------------------------------------
# Proper MIME type for all files
# ----------------------------------------------------------------------


# JavaScript
#   Normalize to standard type (it's sniffed in IE anyways) 
#   tools.ietf.org/html/rfc4329#section-7.2
AddType application/javascript         js

# Audio
AddType audio/ogg                      oga ogg
AddType audio/mp4                      m4a

# Video
AddType video/ogg                      ogv
AddType video/mp4                      mp4 m4v
AddType video/webm                     webm

# SVG
#   Required for svg webfonts on iPad
#   twitter.com/FontSquirrel/status/14855840545
AddType     image/svg+xml              svg svgz 
AddEncoding gzip                       svgz

# Webfonts                             
AddType application/vnd.ms-fontobject  eot
AddType application/x-font-ttf    ttf ttc
AddType font/opentype                  otf
AddType application/x-font-woff        woff

# Assorted types                                      
AddType image/x-icon                   ico
AddType image/webp                     webp
AddType text/cache-manifest            appcache manifest
AddType text/x-component               htc
AddType application/x-chrome-extension crx
AddType application/x-xpinstall        xpi
AddType application/octet-stream       safariextz
AddType text/x-vcard                   vcf

Is this project only about performance?

This this .htaccess is only limited to performance stuffs or something like this is bearable?:

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L]

Wordpress = Bad

Right now, this doesn't work with Wordpress sites. I added it to my blog and was happy to see my Google Page Speed score raise by 8 points (a noticeable improvement) but it broke all links to my posts (404's), homepage loaded fine.

Wordpress requires the following for mod_rewrite, apparently:

ErrorDocument 404 /index.php?error=404 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

Should we fork this for a Wordpress-friendly file? Or is there a better solution I'm missing? I would like to use this for my site but I'm unsure of the best way of going about making it work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.