-
Notifications
You must be signed in to change notification settings - Fork 197
Update .htaccess for Apache 2.4 #513
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
Comments
I'm not an expert in Apache either, but I've been running PW with Apache 2.4 for quite a while without any noticeable issues. Could you please explain exactly what this change does and/or why it's needed? |
Got it -- http://httpd.apache.org/docs/2.4/upgrading.html#access. Had mod_access_compat enabled so didn't need aforementioned update, but it sure looks like this would be a good idea. I'm wondering if version checking of some sort would be feasible here? (Doesn't seem that there's a really clean way to do that, though, at least according to this SO thread.) |
From https://developers.google.com/speed/pagespeed/module/configuration with a few mods for our purpose. The path is problematic though, so maybe just wrap in a IfModule mod_version.c ?
|
That FilesMatch isn't completely necessary since we have a secondary check that uses rewrite rules. I put it there just because it's presumably faster than rewrite rules and can rule out stuff more quickly. Besides, when it comes to security I always figure doubling-up on something can't hurt. But I'm not particularly concerned if the FilesMatch statement stops working as a result of an Apache version because it'll still get picked up by the rewrite rules. But I totally agree with making this Apache 2.4 compatible. MECU's last idea looks good, but it requires knowing the path to apache. We can't hard code paths to Apache in a default htaccess file, so at that point I think we're better off just using MECU's first idea of providing a comment in the htaccess file. |
Maybe just do it like the usually well tested html5-boilerplate project does it: <FilesMatch "(^#.*#|.(bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$">
|
Thanks, it looks like that's a good potential workaround. But also looks like that matches Apache 2.3. Aren't we trying to match Apache 2.4 instead? Or was 2.3 a transitional version where either type of directive would have worked? |
It seems there was never a stable Apache 2.3 release: This is the original commit message with some links for more information: |
I think this can be closed. We have currently rules for both versions in the htaccess which can be swapped by commenting in/out. I also just made a PR (#1128) which incorporates a universal rule like suggested above. |
Thanks, I will close this out and check out that PR you mentioned. |
I'm not an expert in Apache, but I think the only changes required to the .htaccess for upgrading from v2.2 to v2.4 is changing this:
to this:
Perhaps just add a comment like this:
The text was updated successfully, but these errors were encountered: