-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update htaccess with some rules from h5bp/server-configs-apache #1128
base: dev
Are you sure you want to change the base?
Conversation
…ww.` at the beginning of URLs
Wow, thanks for putting this together! Looks like a lot of nice improvements to me :) +1 |
Thanks, looks like some great additions. Since the current .htaccess file is known stable and widely tested I think we'll stick with it for our 2.6 release (which is only days away), but integrate this into the next dev branch. That is, unless you think any of these additions are crucial/emergency, then please let me know. |
I almost always add the html5boilerplate .htaccess stuff to PW projects and never had any problems with it. Definitely a big 👍 for incorporating this into PW. The only thing i can think of that might cause problems for some people are the pretty aggressive Expires headers for css and js (1 year), combined with the removal of Etags. If the filename stays the same (e.g. main.css) returning visitors will get the main.css that is in their local cache for a year since their first visit. So they won't get changes to that file on the server, unless they clear their cache. I do think far future Expires headers is the best way to go but because PW does not do any css/js filename revving out of the box this might surprise some users. |
@SiNNuT is right, the Expires headers and Etag removal is pretty aggressive. Maybe its better to have them only commented. |
The Etag removal caused an internal server error on my Digital Ocean's droplet with Ubuntu 14 and Apache 2.4, so it'd better no to include it by default. As for the Expire Headers and the automatic cache busting of CSS and JS files, this following trick has served me for years: http://www.electrictoolbox.com/force-reload-css-javascript-unique-filenames/ |
I have 2 kind .htaccess file 1 for development, 1 for production Development is standart .htaccess file from ProcessWire Production one has mixed rules (from h5bp, ionizecms) for make website is faster :
If you want to try this rules copy paste rules on top of original .htaccess file (don't forget to make a copy of this file) Don't forget to replace / change "domain.ltd" with your own domain : in rules => Redirect www. to no-www. domain and DOMAIN SHARDING OPTION, if you want to use them... if not remove or comment theese rules |
Jeff Starr made a great document, with mostly everything I would do with htaccess. Could be helpful someday. https://perishablepress.com/stupid-htaccess-tricks/ |
I am adding most of the rules in this PR to every new project. Maybe you want to merge (some of) them into ProcessWires default htaccess file? Maybe commented out?
Source of all these rules is https://github.com/h5bp/server-configs-apache/
When looking at the pw sites directory I think a lot of sites would profit from better performance (deflate, expire headers).