Discussion:
[TYPO3-german] Scriptmerger und die Komprimierung
Börge Hendrik
2016-03-15 18:11:56 UTC
Permalink
Hallo,

ich habe mehrere Installationen:

Typo3 6.2.
Auf der einen läuft Scriptmerger und tut was es soll:
Fast Dateien zusammen und komprimiert sie nach GZIP :)

HTACCESS:
[code language=TypoScript]
#####
#
# Example .htaccess file for TYPO3 CMS - for use with Apache Webserver
#
# This file includes settings for the following configuration options:
#
# - Compression via TYPO3
# - Settings for mod_rewrite (URL-Rewriting)
# - PHP optimisation
# - Miscellaneous
#
# If you want to use it, you have to copy it to the root folder of your TYPO3 installation (if its
# not there already) and rename it to '.htaccess'. To make .htaccess files work, you might need to
# adjust the 'AllowOverride' directive in your Apache configuration file.
#
# IMPORTANT: You may need to change this file depending on your TYPO3 installation!
#
# Lines starting with a # are treated as comment and ignored by the web server.
#
# You should change every occurance of TYPO3root/ to the location where you have your website in.
# For example:
# If you have your website located at http://mysite.com/
# then your TYPO3root/ is just empty (remove 'TYPO3root/')
# If you have your website located at http://mysite.com/some/path/
# then your TYPO3root/ is some/path/ (search and replace)
#
# You can also use this configuration in your httpd.conf, but then you have to modify some lines,
# see the comments (search for 'httpd.conf')
#
# Questions about this file go to the matching Install mailing list, see
# http://typo3.org/documentation/mailing-lists/
#
####


### Begin: Compression via TYPO3 ###

# Compressing resource files will save bandwidth and so improve loading speed especially for users
# with slower internet connections. TYPO3 can compress the .js and .css files for you.
# *) Uncomment the following lines and
# *) Set $TYPO3_CONF_VARS['BE']['compressionLevel'] = '9' for the Backend
# *) Set $TYPO3_CONF_VARS['FE']['compressionLevel'] = '9' together with the TypoScript properties
# config.compressJs and config.compressCss for GZIP compression of Frontend JS and CSS files.

#<FilesMatch "\.js\.gzip$">
# AddType "text/javascript" .gzip
#</FilesMatch>
#<FilesMatch "\.css\.gzip$">
# AddType "text/css" .gzip
#</FilesMatch>
#AddEncoding gzip .gzip

### End: Compression via TYPO3 ###


### Begin: Browser caching of ressource files ###

# Enable long browser caching for JavaScript and CSS files.

# This affects Frontend and Backend and increases performance.
# You can also add other file extensions (like gif, png, jpg), if you want them to be longer cached, too.

<FilesMatch "\.(js|css)$">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 7 days"
</IfModule>
FileETag MTime Size
</FilesMatch>

### End: Browser caching of ressource files ###


### Begin: Settings for mod_rewrite ###

# You need rewriting, if you use a URL-Rewriting extension (RealURL, CoolUri).

<IfModule mod_rewrite.c>

# Enable URL rewriting
RewriteEngine On

# Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
#RewriteBase /

# Rules to set ApplicationContext based on hostname
#RewriteCond %{HTTP_HOST} ^dev\.example\.com$
#RewriteRule .? - [E=TYPO3_CONTEXT:Development]
#RewriteCond %{HTTP_HOST} ^staging\.example\.com$
#RewriteRule .? - [E=TYPO3_CONTEXT:Production/Staging]
#RewriteCond %{HTTP_HOST} ^www\.example\.com$
#RewriteRule .? - [E=TYPO3_CONTEXT:Production]

# Rule for versioned static files, configured through:
# - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
# - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]

# Basic security checks
# - Restrict access to deleted files in Recycler directories
# - Restrict access to TypoScript files in default templates directories
# - Restrict access to Private extension directories
# For httpd.conf, use these lines instead of the next ones:
# RewriteRule ^/TYPO3root/fileadmin/(.*/)?_recycler_/ - [F]
# RewriteRule ^/TYPO3root/fileadmin/templates/.*(\.txt|\.ts)$ - [F]
# RewriteRule ^/TYPO3root/typo3conf/ext/[^/]+/Configuration/ - [F]
# RewriteRule ^/TYPO3root/typo3conf/ext/[^/]+/Resources/Private/ - [F]
RewriteRule ^fileadmin/(.*/)?_recycler_/ - [F]
RewriteRule ^fileadmin/templates/.*(\.txt|\.ts)$ - [F]
RewriteRule ^typo3conf/ext/[^/]+/Configuration/ - [F]
RewriteRule ^typo3conf/ext/[^/]+/Resources/Private/ - [F]

# Stop rewrite processing, if we are in the typo3/ directory.
# For httpd.conf, use this line instead of the next one:
# RewriteRule ^/TYPO3root/(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]

# If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

# Main URL rewriting.
# For httpd.conf, use this line instead of the next one:
# RewriteRule .* /TYPO3root/index.php [L]
RewriteRule .* index.php [L]

</IfModule>

### End: Settings for mod_rewrite ###


### Begin: PHP optimisation ###

# If you do not change the following settings, the default values will be used.

# TYPO3 works fine with register_globals turned off.
# This is highly recommended, if your web server has it turned on.
#php_flag register_globals off

### End: PHP optimisation ###



### Begin: Miscellaneous ###

# Make sure that directory listings are disabled.
#Options -Indexes

### End: Miscellaneous ###


# Add your OWN RULES HERE (! ! ! !).
# ...
##### Einstellungen für realurl #####
RewriteEngine On
RewriteBase /
RewriteRule ^(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)/ - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
#RewriteRule .* /index.php [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} (^.htm$|^.html$)
RewriteRule (.*[^/])$ %{HTTP_HOST}/$1/ [L,R]



##### Umleitung von https zu http: #####
RewriteCond %{SERVER_PORT} !^80$
RewriteRule (.*) http://%{HTTP_HOST}/$1 [L]



#### Umleitung www.Domain: ####
RewriteEngine on
RewriteCond %{HTTP_HOST} ^DOMAIN1\.de$ [NC]
RewriteRule ^(.*)$ http://www.DOMAIN1.de/$1 [R=301,L]

RewriteEngine on
RewriteCond %{HTTP_HOST} ^DOMAIN2\.de$ [NC]
RewriteRule ^(.*)$ http://www.DOMAIN2.de/$1 [R=301,L]

#### Umleitung www.Domain: ####
#RewriteEngine on
#Options +FollowSymlinks
#RewriteEngine on
#RewriteRule ^showresults.php(.*)$ http://www.DOMAIN1.de/showresults.php$1 [r=301,nc]


##### Scriptmerger Settings: Expires Header + Removal of ETag #####
<FilesMatch "\.(ico|png|gif|js|css|jpg|jpeg|swf)">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 2 months"
</IfModule>

# ETag
FileETag MTime Size
<IfModule mod_headers.c>
FileETag none
Header unset Last-Modified
</IfModule>
</FilesMatch>

# Compressed Content
<FilesMatch "\.gz\.(js|css)">
<IfModule mod_headers.c>
Header set Content-Encoding gzip
</IfModule>
</FilesMatch>

##### GZIP Kompriemierung: #####
### Begin: Compression via TYPO3 ###
# Compressing resource files will save bandwidth and so improve loading speed especially for users# with slower internet connections. TYPO3 can compress the .js and .css files for you.# *) Uncomment the following lines and# *) Set $TYPO3_CONF_VARS['BE']['compressionLevel'] = '5' for the Backend# *) Set $TYPO3_CONF_VARS['FE']['compressionLevel'] = '5' together with the TypoScript properties# config.compressJs and config.compressCss for GZIP compression of Frontend JS and CSS files.
AddType "text/javascript" .gzip AddType "text/css" .gzipAddEncoding gzip .gzip
AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-shockwave-flash

### End: Compression via TYPO3 ###

### Begin: Browser caching of ressource files ###
# Enable long browser caching for JavaScript and CSS files.
# This affects Frontend and Backend and increases performance.# You can also add other file extensions (like gif, png, jpg), if you want them to be longer cached, too.
ExpiresActive on ExpiresDefault "access plus 7 days" FileETag MTime Size
### End: Browser caching of ressource files ###
[/code]

SETUP-Code für die Aktivierung:
[code language=TypoScript]
#Scriptmerger: Dateien zusammenfassen.
# JS Body Dateien Zusammenfassen:
plugin.tx_scriptmerger.javascript.parseBody = 1
# CSS Dateien zusammenfassen
plugin.tx_scriptmerger {
css {
minify {
enable = 1
ignore = \.min\.
}
compress {
enable = 1
ignore = \.gz\.
}
merge {
enable = 1
ignore =
}
}
javascript {
minify {
enable = 1
ignore = \?,\.min\.
}
compress {
enable = 1
ignore = \?,\.gz\.
}
merge {
enable = 1
ignore = \?
}
}
}[/code]

Obgleich ich in All Configuration die Compressionswerte auf 0 stehen läuft es.
Dieselbe Konfiguration habe ich nun auf eine zweite und dritte Seite übertragen angelegt und Kopiert.
Auf das Template für den Scriptmerger wurde eingebunden.

Ergebnis, die Dateien werden zusammengefasst, jedoch erfolgt keine GZIP Komprimierung auf der zweiten und dritten Seite.

Habe bereits folgendes probiert:
- Andere Extension Templates rausgenommen oder hinzugefügt.
- Andere htaccess verwendet auch das Original aus der Extension.
- Auch mit diesen Einstellungen habe ich es probiert:
[code language=TypoScript]
config.no_cache = 0
config.compressJs = 1
config.compressCss = 1
config.concatenateJs = 1
config.concatenateCss = 1[/code]
- Auch habe ich einfach Code aus meiner Setup.TS massig entfernt um zu testen.
- Alle Extension aktualisiert

Es bleibt aber immer gleich auf der 1 Typo 3 6.2 läuft die Kompriemierung auf den anderen beiden nicht.

Hat noch jemand eine Idee oder eine Alternative?
Vielen Dank im Voraus.
Auch
Stefan Padberg
2016-03-16 07:05:22 UTC
Permalink
Post by Börge Hendrik
Hallo,
Typo3 6.2.
Fast Dateien zusammen und komprimiert sie nach GZIP :)
Es bleibt aber immer gleich auf der 1 Typo 3 6.2 läuft die
Kompriemierung auf den anderen beiden nicht.
Hat noch jemand eine Idee oder eine Alternative?
Hi,

sind die Server alle gleich? Oder sind die vielleicht bei
unterschiedlichen Providern?

Die Komprimierung muss serverseitig auch möglich sein. Und nicht jeder
"Feld-, Wald- und Wiesenserver" macht das automatisch.

Beste Grüße
stefan
--
Bergische Webschmiede
Dipl.-Ing. Stefan Padberg
TYPO3-Integrator und Webprogrammierer
:: Borner Str. 18 - 42349 Wuppertal
:: +49 202 97648355
:: +49 173 9219845
:: ***@bergische-webschmiede.de
:: http://www.bergische-webschmiede.de
Börge Hendrik
2016-03-16 07:28:25 UTC
Permalink
Hallo Stefan,

vielen Dank.

- Selber Provider, (Domainfactory)
- Selbes Hostingpaket
- Selbe PHP Version und auch die gleichen Einstellungen in der Ini PHP

Einzige Unterschiede zwischen den Installationen sind die Inhalte und einige Extensions.

sr_freecap, JK_Poll, Femanager, Comments, Pagebrowse, sr_freecap, directmail, shariff, news, (news sitemap)

und 1. Installation (2 Domains), 2. Installation (2 Domains) und 3. Installation 1 Domain.

Bei der ersten (funktionierenden) Installation hatte ich mal "xf_imgopt" installiert und wieder deinstalliert.
Hatte auch schon den Scriptmerger bei den anderen deinstalliert, gelöscht und erneut installiert.

Kann man bei der Reihenfolge Scriptmerger einen Fehler machen, sprich wenn htaccess und setup schon drin sind, wenn er installiert wird?
Börge Hendrik
2016-03-16 08:19:46 UTC
Permalink
Ein weiterer Unterschied ist noch:


1. Installation ist ein Upgrade von Typo3 4.5

2. und 3 wurden auf Typo3 6.2 neue aufgesetzt.
Börge Hendrik
2016-03-17 16:32:09 UTC
Permalink
Nach längeren Suchen habe ich herausgefunden, sobald ich den Scriptmerger deinstalliere,
ist auch GZIP wieder aktiv, jedoch ohne das ein Komprimierungsgrad ausgegeben wird.

- htaccess ist eingestellt.
- Werte in All Configuration auf 9 FE und 5 BE gesetzt.
- Die Werte eingetragen:
config.compresscss = 1
config.compressjs = 1

Hat jemand eine Idee, warum nach der Installation des Scriptmerger die GZIP Komprimierung abgestellt wird?
Börge Hendrik
2016-03-20 17:42:39 UTC
Permalink
Eine Klärung brachte nun am Ende mein Provider (Domainfactory) der einen erstklassigen Service hat, vielen Dank!

Der Scriptmerger arbeitet wie die GZIP Komprimierung korrekt.
Das Tool, mit dem ich die GZIP Komprimierung geprüft habe, hat jedoch die Komprimierung nicht erkannt, da ich vom Startbaum der Typo3 Installation einen Redirect auf die Home-Seite hatte.

Nachdem entfernen des Redirect wurde es dann richtig angezeigt.

Loading...