Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: serve pre-compressed content by default
ruud wrote #292025:
I don’t think Apache 1.x had mod_deflate. It was mod_gzip back then. Might as well remove the Apache 1.3 tip. Are there still people using that ancient version?
Well, it’s possible to have mod_deflate
on Apache 1.3 (see here and brace yourself), but you’re right – mod_gzip
would be better.
I included Apache 1.3 support because, well, Textpattern still runs on it and it’s listed in the system requirements.
However…
Apache 1.3 was EOL’d in 2010. The sys reqs page likely hasn’t been overhauled since then, so I move that Apache 1.3 support be removed from 4.6. I will have spawned a new thread here.
Last edited by gaekwad (2015-06-25 08:29:25)
Offline
Re: serve pre-compressed content by default
jstubbs wrote #292023:
If it’s something that helps TXP users generally, it might make a good TXP Tip then?
As I am not an expert on it I am posting some htaccess rules which work on my sites here for the community to develop them before they go to the tips site.
# Force i.e. 8,9,10 to render pages in the highest mode available.
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=edge"
</IfModule>
# force UTF-8
AddDefaultCharset utf-8
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Redirect complete txp installation from subdirectory to root
RedirectMatch 301 ^/subdirectory/?(.+)?$ http://www.site.tld/$1
# Redirect from the http to the https
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{HTTPS} !=on
# RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# </IfModule>
# Use Option 1 or Option 2
# Option 1: rewrite www.yoursite.tld TO yoursite.tld
RewriteCond %{HTTP_HOST} ^www\.yoursite\.tld [NC]
RewriteRule ^(.*)$ http://yoursite.tld/$1 [L,R=301]
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Option 2: rewrite yoursite.tld TO www.yoursite.tld
RewriteCond %{HTTP_HOST} ^yoursite.tld [NC]
RewriteRule ^(.*)$ http://www.yoursite.tld/$1 [L,R=301]
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Compression
<IfModule deflate_module>
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Remove ETags
<IfModule mod_headers.c>
Header unset ETag
FileETag None
</IfModule>
FileETag None
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# deter hackers - edit to suit your site
RewriteCond %{REQUEST_URI} (admin|ckeditor|ckfinder|connector|connectors|FileZilla|kcfinder|editor|fckeditor|Tester|uploadTester|wp|wp-admin|wp-content|webmanage|manage|wp-login|bookmarklets|xmlrpc) [NC]
RewriteRule .* http://127.0.0.1/ [R=301,L]
# ensure content is not embedded in other sites - not widely supported
Header append X-FRAME-OPTIONS "SAMEORIGIN"
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Expires headers - for google speed tools |
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rdf+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/xml "access plus 1 day"
ExpiresByType text/xml "access plus 1 day"
ExpiresByType text/html "access plus 1 day"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
</IfModule>
# privacy
ServerSignature Off
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# security
<Files .htaccess>
deny from all
</Files>
<Files config.php>
deny from all
</Files>
# txp troubleshooting
# <IfModule mod_security.c>
# SecRuleEngine Off
# SecFilterInheritance Off
# SecFilterEngine Off
# SecFilterScanPOST Off
# SecFilterSelective REMOTE_ADDR ^###.###.###.###$ nolog,allow
# </IfModule>
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# standard txp rules
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /relative/web/path/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
#php_value register_globals 0
# SVG
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: serve pre-compressed content by default
colak wrote #292161:
As I am not an expert on it I am posting some htaccess rules which work on my sites here for the community to develop them before they go to the tips site.
Yiannis, I played around with your .htaccess rules locally, I don’t see any errors, nor did my server.
I really like the deter hackers section, I think it should be part of a default install, my logs are constantly being filled with wp-admin and wp-login requests.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
Re: serve pre-compressed content by default
hcgtv wrote #293331:
I really like the deter hackers section, I think it should be part of a default install, my logs are constantly being filled with wp-admin and wp-login requests.
I am glad it works for you.
I added those – with the help I received here – as there was an attack on one of my sites consisting of over 120,000 hits in an hour requesting wp pages.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline