Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2015-06-24 19:23:52

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,362
Website

Re: serve pre-compressed content by default

philwareham wrote #291963:

There are plenty of resources on GitHub for that sort of thing already, like here and here.

Indeed but if we want to atract newbies we have to assume that they would not know how, where and more importantly what to look for. I’ll think of more examples tomorrow and post them here.

I understand what you are saying that this is not txp specific but since I added those lines in my htaccess, I saw a huge improvement in the speed of my site and I think that this will work for us regarding the first user experiences of the cms.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#22 2015-06-24 19:27:02

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,209
Website

Re: serve pre-compressed content by default

OK, Pete has very kindly written an article on it which will go on the future docs site.

Offline

#23 2015-06-25 02:30:44

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,394
Website

Re: serve pre-compressed content by default

colak wrote #292006:

Indeed but if we want to atract newbies we have to assume that they would not know how, where and more importantly what to look for. I’ll think of more examples tomorrow and post them here.

I understand what you are saying that this is not txp specific but since I added those lines in my htaccess, I saw a huge improvement in the speed of my site and I think that this will work for us regarding the first user experiences of the cms.

If it’s something that helps TXP users generally, it might make a good TXP Tip then?

Offline

#24 2015-06-25 07:49:28

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: serve pre-compressed content by default

philwareham wrote #292007:

OK, Pete has very kindly written an article on it which will go on the future docs site.

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?

Offline

#25 2015-06-25 08:13:16

gaekwad
Admin
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 2,633

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

#26 2015-06-27 06:38:06

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,362
Website

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.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#27 2015-07-16 12:50:28

hcgtv
Plugin Author
From: Miami, Florida
Registered: 2005-11-29
Posts: 2,634
Website

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.

Offline

#28 2015-07-16 13:07:16

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,362
Website

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.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

Board footer

Powered by FluxBB