Marcus
Avatar Marcus
Themenersteller
Guru (224 Beiträge)

htaccess anpassen

am 25.07.2015, 11:03 Uhr eröffnete Marcus folgenden Thread
Wordpress    9016 mal gelesen    19 Antwort(en).

Hallo zusammen!

Mag mir jemand helfen, meine htaccess an die Bedürfnisse von Wordpress anzupassen?

Ich nehme mal an, das ich mit all dem, was ich dort drin stehen habe, mich selbst ausbremse

SetOutputFilter DEFLATE
AddHandler php56-cgi .php
php_value memory_limit 256M

<IfModule mod_php5.c>
php_value post_max_size 32M
php_value upload_max_filesize 32M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
php_value session.gc_maxlifetime 86400
</IfModule>

RewriteRule ^login$ xxx/wp-login.php [NC,L]



<Files wp-login.php>
AuthName "Restricted Admin-Bereich"
AuthType Basic
AuthUserFile /xxx/xxx/xxx/xxx/.htpasswd
require valid-user
</Files>

php_flag log_errors on
php_value error_reporting E_ALL
php_value error_log /xxx/xxx/xxx/xxx/errorlog/error.log

# BEGINN CACHIFY
<IfModule mod_rewrite.c>
# ENGINE ON
RewriteEngine On

# GZIP FILE
<IfModule mod_mime.c>
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|
wordpress_logged_in|comment_author)_
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cachify/%{HTTP_HOST}%
{REQUEST_URI}/index.html.gz -f
RewriteRule ^(.*) /wp-content/cache/cachify/%
{HTTP_HOST}/$1/index.html.gz [L]

AddType text/html .gz
AddEncoding gzip .gz
</IfModule>

# HTML FILE
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|
comment_author)_RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/
cachify/%{HTTP_HOST}%
{REQUEST_URI}/index.html -f
RewriteRule ^(.*) /wp-content/cache/cachify/%{HTTP_HOST}/$1/index.html [L]
</IfModule>
# END CACHIFY

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule ^(wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>

<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>

AddType image/webp .webp

# Mod Pagespeed
<IfModule pagespeed_module>
ModPagespeed on
# using commands,filters etc
</IfModule>

# Gzip Komprimierung
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
AddOutputFilterByType DEFLATE image/svg+xml application/
xhtml+xml application/xml
AddOutputFilterByType DEFLATE application/rdf+xml application/
rss+xml application/atom+xml
AddOutputFilterByType DEFLATE text/javascript application/
javascript application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf application/
x-font-otf
AddOutputFilterByType DEFLATE font/truetype font/opentype
</IfModule>

# Browsercache 1 Tag
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month 1 days"
ExpiresByType text/html "access plus 1 month 1 days"
ExpiresByType image/gif "access plus 1 month 1 days"
ExpiresByType image/jpeg "access plus 1 month 1 days"
ExpiresByType image/png "access plus 1 month 1 days"
ExpiresByType text/css "access plus 1 month 1 days"
ExpiresByType text/javascript "access plus 1 month 1 week"
ExpiresByType application/x-javascript "access plus 1 month 1 days"
ExpiresByType text/xml "access plus 1 seconds"
</IfModule>

# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
# <filesMatch "\.(x?html?|php)$">
# Header set Cache-Control "private, must-revalidate"
# </filesMatch>
</ifModule>
# END Cache-Control Headers

#ETags entfernen
<ifModule mod_headers.c>
Header unset ETag
</ifModule>
FileETag None

# Hotlinking verbieten
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?salzsau-panorama\.de(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule \.(gif|jpg|GIF|JPG|png|PNG)$ - [F]

# Zugriff auf Dateien verbieten / WordPress Sicherheit
<Files wp-config.php>
order allow,deny
deny from all
</Files>

<Files .htaccess>
order allow,deny
deny from all
</Files>

<Files readme.html>
Order Allow,Deny
Deny from all
Satisfy all
</Files>

<Files liesmich.html>
Order Allow,Deny
Deny from all
Satisfy all
</Files>

<Files install.php>
Order Allow,Deny
Deny from all
Satisfy all
</Files>

Options -Indexes

RewriteCond %{QUERY_STRING} !error
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(wp-includes|wp-content)/(.+)\.php\ HTTP/
RewriteRule .* - [F]

<ifmodule mod_rewrite.c>
RewriteCond %{QUERY_STRING} ftp\: [NC,OR]
RewriteCond %{QUERY_STRING} http\: [NC,OR]
RewriteCond %{QUERY_STRING} https\: [NC]
RewriteRule .* - [F,L]
</ifmodule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>

Redirect 301 /+ plus.google.com/xxx/about


Redirect 301 /plus plus.google.com/xxx/about



RewriteCond %{QUERY_STRING} replytocom=
RewriteRule ^(.*)$ page_not_found.html [R=410,L]

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$

RewriteRule ^(.*)$ %{HTTP_HOST}/$1/ [R=301,L]



<IfModule mod_setenvif.c>
<Files xmlrpc.php>
BrowserMatch "Poster" allowed
BrowserMatch "WordPress" allowed
BrowserMatch "Windows Live Writer" allowed
BrowserMatch "wp-iphone" allowed
BrowserMatch "wp-android" allowed
Order Deny,Allow
Deny from All
Allow from env=allowed
</Files>
</IfModule>

# ----------------------------------------------------------------------
# Wichtige Sicherheitseinstellungen
# ----------------------------------------------------------------------

#wichtige Dateien gegen Zugriff von außen Blocken
<files install.php>
Order allow,deny
Deny from all
</files>

<files wp-config.php>
Order allow,deny
Deny from all
</files>

# PROTECT readme.html
<files readme.html>
Order Allow,Deny
Deny from all
Satisfy all
</Files>

# PROTECT liesmich.html für DE Edition
<Files liesmich.html>
Order Allow,Deny
Deny from all
Satisfy all
</Files>

<files error_log>
Order allow,deny
Deny from all
</files>

# Keine URL based exploits zulassen
RedirectMatch 403 \[
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Double slashes in allen URLs verbieten
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /(([^/\ ]+/)*)/+([^\ ]*)
RewriteRule ^ /%1%3 [L,R=301]
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule ^(wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>

Vielen Dank im voraus schon mal

Marcus


Das Regional-Magazin für Lüneburg und die Region:
salzsau-panorama.de

matthes
Avatar matthes
Foren Moderator
Evil Genius
Content Halbgott (973 Beiträge)
am 25.07.2015, 18:56 Uhr schrieb matthes

Die ersten Schritte kannst Du selber machen. Nämlich alles sortieren.
Über die ganze Datei sind mod_rewrite-Regeln verteilt, die an eine gemeinsame Stelle verschieben (Reihenfolge untereinander und Kommentare zu einzelnen Zeilen aber möglichst einhalten/erhalten).
Da etliche Rewrite-Regeln außerhalb von ifmodule stehen, kannst Du darauf verzichten, weil mod_rewrite ganz offensichtlich geladen wird.

Alle mod_headers an eine gemeinsame Stelle verschieben.

Alle... Ich denke, Du verstehst das Prinzip.

Anschließend kann man es sich ansehen, ohne einen Knoten im Hirn zu bekommen. Dann folgt der zweite Schritt, für den Du wissen müsstest, wie die Servereinstellungen sind. Wenn beispielsweise die ganzen php_values nämlich nicht abweichend gesetzt sind, könnten die raus. Wenn sie abweichend gesetzt sind, müsstest Du prüfen, was Du davon brauchst. Gleiches gilt für alle anderen sortierten Regeln - und Duplikate können ohnehin entfernt weden.

Das deny from all für die .htaccess ist Standard, entfernen und versuchen, die .htaccess aufzurufen - klappt es nicht, braucht der Code nicht wieder in die .htaccess zu rutschen.

"Satisfy all" ist in der Konfiguration, die vorliegt, Unsinn, kann überall raus.
Die Files-Direktiven sind teilweise doppelt, eine reicht.

Options kann man zusammenfassen, vorher aber prüfen, wie die Standardeinstellung ist.

Mehr, wenn es aufgeräumt ist.
PS: Schön, dass Du auf die Breite geachtet hast.


Make Seitenreport great again!

Marcus
Avatar Marcus
Guru (224 Beiträge)
am 26.07.2015, 11:01 Uhr schrieb Marcus

Hallo Mattes!

Ich habe versucht, die Datei jetzt etwas zu sortieren und die Werte zu überprüfen. Ein paar konnte ich in der Tat raus schmeißen, weil die Master-Werte größer waren als der Lokale Wert.

SetOutputFilter DEFLATE
AddHandler php56-cgi .php
php_value memory_limit 256M

# mod php5.c
php_value max_execution_time 300
php_value max_input_time 300
php_value session.gc_maxlifetime 86400

RewriteRule ^login$ xxx/wp-login.php [NC,L]



<Files wp-login.php>
AuthName "Restricted Admin-Bereich"
AuthType Basic
AuthUserFile /xxx/.htpasswd
require valid-user
</Files>

php_flag log_errors on
php_value error_reporting E_ALL
php_value error_log /xxx/error.log

# BEGINN CACHIFY
# mod_rewrite.c
# ENGINE ON
RewriteEngine On

# GZIP FILE
#mod_mime.c
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in
|comment_author)_
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache
/cachify/
%{HTTP_HOST}%{REQUEST_URI}/index.html.gz -f
RewriteRule ^(.*) /wp-content/cache/cachify/%{HTTP_HOST}/$1/index.html.gz [L]

AddType text/html .gz
AddEncoding gzip .gz

# HTML FILE
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in
|comment_author)_
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cachify/
%{HTTP_HOST}%{REQUEST_URI}/index.html -f
RewriteRule ^(.*) /wp-content/cache/cachify/
%{HTTP_HOST}/$1/index.html [L]
# END CACHIFY

# mod_rewrite.c
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule ^(wp-content/uploads.+)\\.(jpe?g|png)$ $1.webp
[T=image/webp,E=accept:1]

# Hotlinking verbieten
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\\.)?xxx\\.de(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} !google\\. [NC]
RewriteCond %{HTTP_REFERER} !search\\?q=cache [NC]
RewriteRule \\.(gif|jpg|GIF|JPG|png|PNG)$ - [F]

RewriteCond %{QUERY_STRING} !error
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\\ /(wp-includes|wp-content)/(.+)\\.php\\ HTTP/
RewriteRule .* - [F]

# mod rewrite.c
RewriteCond %{QUERY_STRING} ftp\\: [NC,OR]
RewriteCond %{QUERY_STRING} http\\: [NC,OR]
RewriteCond %{QUERY_STRING} https\\: [NC]
RewriteRule .* - [F,L]

# BEGIN WordPress
# mod_rewrite.c
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

RewriteCond %{QUERY_STRING} replytocom=
RewriteRule ^(.*)$ page_not_found.html [R=410,L]

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/[^\\.]+[^/]$

RewriteRule ^(.*)$ %{HTTP_HOST}/$1/ [R=301,L]



# Keine URL based exploits zulassen
RedirectMatch 403 \\[

# mod_rewrite.c
RewriteEngine On
RewriteBase /

# Double slashes in allen URLs verbieten
RewriteCond %{THE_REQUEST} ^[A-Z]+\\ /(([^/\\ ]+/)*)/+([^\\ ]*)
RewriteRule ^ /%1%3 [L,R=301]

# BEGIN Cache-Control Headers
# mod_headers.c
<filesMatch "\\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\\.(js)$">
Header set Cache-Control "private"
</filesMatch>
# <filesMatch "\\.(x?html?|php)$">
# Header set Cache-Control "private, must-revalidate"
# </filesMatch>
# END Cache-Control Headers

#ETags entfernen
# mod_headers.c
Header unset ETag
FileETag None

# mod_headers.c
Header append Vary Accept env=REDIRECT_accept

AddType image/webp .webp

# Mod Pagespeed
<IfModule pagespeed_module>
ModPagespeed on
# using commands,filters etc
</IfModule>

# Gzip Komprimierung
# mod_deflate.c
AddOutputFilterByType DEFLATE text/html text/xml text/
css text/plain
AddOutputFilterByType DEFLATE image/svg+xml application/
xhtml+xml application/xml
AddOutputFilterByType DEFLATE application/rdf+xml application/
rss+xml application/atom+xml
AddOutputFilterByType DEFLATE text/javascript application/
javascript application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf application/
x-font-otf
AddOutputFilterByType DEFLATE font/truetype font/opentype

# Browsercache 1 Tag
# mod_expires.c
ExpiresActive On
ExpiresDefault "access plus 1 month 1 days"
ExpiresByType text/html "access plus 1 month 1 days"
ExpiresByType image/gif "access plus 1 month 1 days"
ExpiresByType image/jpeg "access plus 1 month 1 days"
ExpiresByType image/png "access plus 1 month 1 days"
ExpiresByType text/css "access plus 1 month 1 days"
ExpiresByType text/javascript "access plus 1 month 1 week"
ExpiresByType application/x-javascript "access plus 1 month 1 days"
ExpiresByType text/xml "access plus 1 seconds"

# mod_setenvif.c
<Files xmlrpc.php>
BrowserMatch "Poster" allowed
BrowserMatch "WordPress" allowed
BrowserMatch "Windows Live Writer" allowed
BrowserMatch "wp-iphone" allowed
BrowserMatch "wp-android" allowed
Order Deny,Allow
Allow from env=allowed
</Files>

# Zugriff auf Dateien verbieten / WordPress Sicherheit
<Files wp-config.php>
order allow,deny
</Files>

<Files .htaccess>
order allow,deny
</Files>

# PROTECT readme.html
<Files readme.html>
Order Allow,Deny
</Files>

# PROTECT liesmich.html für DE Edition
<Files liesmich.html>
Order Allow,Deny
</Files>

<Files install.php>
Order Allow,Deny
</Files>

<files error_log>
Order allow,deny
</files>

# protect wpconfig.php
<files wp-config.php>
order allow,deny
</files>

Options -Indexes

Redirect 301 /+ plus.google.com/xxx/about


Redirect 301 /plus plus.google.com/xxx/about



PS: Möchte mich wegen der Überlänge ja nicht zwei Mal blamieren


Das Regional-Magazin für Lüneburg und die Region:
salzsau-panorama.de

matthes
Avatar matthes
Foren Moderator
Evil Genius
Content Halbgott (973 Beiträge)
am 26.07.2015, 13:23 Uhr schrieb matthes

Gute Arbeit. So ist es gleich viel übersichtlicher.
Leider gab es ein Missverständnis: "deny from all" hättest Du nicht entfernen dürfen - das habe ich aber wieder hinzugefügt.
Rund 30 Zeilen haben wir jetzt eingespart. Jetzt müsstest Du weiter überprüfen, ob die Zeilen alle benötigt werden.

Verwendest Du cachify für Wordpress noch (Zeile 29-48)? Manchmal steht unnötiger Ballast von nicht mehr benutzten Plugins drin.

Verwendest Du webp wirklich (Zeile 20 und Zeile 50-52)?

Ist ModPagespeed auf Deinem Server vorhanden (Zeile 108-112)?

Wie sind die Standard Cache-Control-Header (Zeile 87-98)? Wenn der Server die per Standard so setzt, ist die Anweisung unnötig. Zeilen rausnehmen und überprüfen, weglassen, falls es so ist, wie es sein soll.

Gleiches gilt für Gzip (Zeile 114-126) und Expires (Zeile 128-139).

[html]SetOutputFilter DEFLATE
AddHandler php56-cgi .php
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
php_value session.gc_maxlifetime 86400
php_flag log_errors on
php_value error_reporting E_ALL
php_value error_log /xxx/error.log

<Files wp-login.php>
AuthName "Restricted Admin-Bereich"
AuthType Basic
AuthUserFile /xxx/.htpasswd
require valid-user
</Files>

AddType text/html .gz
AddEncoding gzip .gz
AddType image/webp .webp

Options +FollowSymlinks -Indexes

RewriteEngine On
RewriteBase /

RewriteRule ^login$ xxx/wp-login.php [NC,L]



# BEGINN CACHIFY
# GZIP FILE
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cachify/%{HTTP_HOST}%{REQUEST_URI}/index.html.gz -f
RewriteRule ^(.*) /wp-content/cache/cachify/%{HTTP_HOST}/index.html.gz [L]

# HTML FILE
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cachify/%{HTTP_HOST}%{REQUEST_URI}/index.html -f
RewriteRule ^(.*) /wp-content/cache/cachify/%{HTTP_HOST}/index.html [L]
# END CACHIFY

RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/.webp -f
RewriteRule ^(wp-content/uploads.+)\\.(jpe?g|png)$ .webp [T=image/webp,E=accept:1]

# Hotlinking verbieten
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\\.)?xxx\\.de(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} !google\\. [NC]
RewriteCond %{HTTP_REFERER} !search\\?q=cache [NC]
RewriteRule \\.(gif|jpg|GIF|JPG|png|PNG)$ - [F]

RewriteCond %{QUERY_STRING} !error
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\\ /(wp-includes|wp-content)/(.+)\\.php\\ HTTP/
RewriteRule .* - [F]

RewriteCond %{QUERY_STRING} ftp\\: [NC,OR]
RewriteCond %{QUERY_STRING} http\\: [NC,OR]
RewriteCond %{QUERY_STRING} https\\: [NC]
RewriteRule .* - [F,L]

# BEGIN WordPress
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

RewriteCond %{QUERY_STRING} replytocom=
RewriteRule ^(.*)$ page_not_found.html [R=410,L]

RewriteCond %{REQUEST_URI} ^/[^\\.]+[^/]$

RewriteRule ^(.*)$ %{HTTP_HOST} [R=301,L]



# Double slashes in allen URLs verbieten
RewriteCond %{THE_REQUEST} ^[A-Z]+\\ /(([^/\\ ]+/)*)/+([^\\ ]*)
RewriteRule ^ /%1%3 [L,R=301]

# BEGIN Cache-Control Headers
# mod_headers.c
<filesMatch "\\.(ico|jpe?g|png|gif|swf|css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\\.(js)$">
Header set Cache-Control "private"
</filesMatch>
# <filesMatch "\\.(x?html?|php)$">
# Header set Cache-Control "private, must-revalidate"
# </filesMatch>
# END Cache-Control Headers

#ETags entfernen
# mod_headers.c
Header unset ETag
FileETag None

# mod_headers.c
Header append Vary Accept env=REDIRECT_accept

# Mod Pagespeed
<IfModule pagespeed_module>
ModPagespeed on
# using commands,filters etc
</IfModule>

# Gzip Komprimierung
# mod_deflate.c
AddOutputFilterByType DEFLATE text/html text/xml text/
css text/plain
AddOutputFilterByType DEFLATE image/svg+xml application/
xhtml+xml application/xml
AddOutputFilterByType DEFLATE application/rdf+xml application/
rss+xml application/atom+xml
AddOutputFilterByType DEFLATE text/javascript application/
javascript application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf application/
x-font-otf
AddOutputFilterByType DEFLATE font/truetype font/opentype

# Browsercache 1 Tag
# mod_expires.c
ExpiresActive On
ExpiresDefault "access plus 1 month 1 days"
ExpiresByType text/html "access plus 1 month 1 days"
ExpiresByType image/gif "access plus 1 month 1 days"
ExpiresByType image/jpeg "access plus 1 month 1 days"
ExpiresByType image/png "access plus 1 month 1 days"
ExpiresByType text/css "access plus 1 month 1 days"
ExpiresByType text/javascript "access plus 1 month 1 week"
ExpiresByType application/x-javascript "access plus 1 month 1 days"
ExpiresByType text/xml "access plus 1 seconds"

# mod_setenvif.c
<Files xmlrpc.php>
BrowserMatch "Poster" allowed
BrowserMatch "WordPress" allowed
BrowserMatch "Windows Live Writer" allowed
BrowserMatch "wp-iphone" allowed
BrowserMatch "wp-android" allowed
Order Deny,Allow
Allow from env=allowed
</Files>

# Zugriff auf Dateien verbieten / WordPress Sicherheit
<Files wp-config.php>
order allow,deny
deny from all
</Files>

# PROTECT readme.html
<Files readme.html>
Order Allow,Deny
deny from all
</Files>

# PROTECT liesmich.html für DE Edition
<Files liesmich.html>
Order Allow,Deny
deny from all
</Files>

<Files install.php>
Order Allow,Deny
deny from all
</Files>

<files error_log>
Order allow,deny
deny from all
</files>

Redirect 301 /+ plus.google.com/xxx/about


Redirect 301 /plus plus.google.com/xxx/about


# Keine URL based exploits zulassen
RedirectMatch 403 \\[[/html]

PS: Zeilenumbrüche trotz Designzerstörung absichtlich weggelassen, damit die Zeilenzahlen bleiben und du es einfach kopieren kannst...


Make Seitenreport great again!

Marcus
Avatar Marcus
Guru (224 Beiträge)
am 26.07.2015, 16:33 Uhr schrieb Marcus

Danke Mattes, für deine Mühe.

Post bearbeitet: Fehler gefunden

Bei den Anweisungen zur Gzip-Komprimierung standen noch Teile von vorhergehenden Zeilen in einer neuen.

Zu Deinen weiteren Fragen:

Cachify wird noch verwendet. Zudem ist Optimus HQ im Einsatz, woher die webp-Anweisungen stammen.

Das Pagespeed-Modul läuft ohne die If-Anweisungen nicht.

Zu den Zeilen 87 - 98 (Cache-Control-Header), Gzip (114-126) Expires (128-139) wie überprüfe ich das jetzt?


Das Regional-Magazin für Lüneburg und die Region:
salzsau-panorama.de

Marcus
Avatar Marcus
Guru (224 Beiträge)
am 26.07.2015, 18:11 Uhr schrieb Marcus

Sehe ich das richtig, das wenn beim Server SERVER["HTTP_ACCEPT_ENCODING"] deflate und gzip steht, dann können zumindest die Zeilen für gzip entfernt werden?

session.cache_expire steht auf 180, damit dürften - wenn ich das richtig verstehe auch die Angaben für den Browsercache wegfallen, oder?


Das Regional-Magazin für Lüneburg und die Region:
salzsau-panorama.de

matthes
Avatar matthes
Foren Moderator
Evil Genius
Content Halbgott (973 Beiträge)
am 27.07.2015, 00:16 Uhr schrieb matthes

Marcus schrieb:
Sehe ich das richtig, das wenn beim Server SERVER["HTTP_ACCEPT_ENCODING"] deflate und gzip steht, dann können zumindest die Zeilen für gzip entfernt werden?
session.cache_expire steht auf 180, damit dürften - wenn ich das richtig verstehe auch die Angaben für den Browsercache wegfallen, oder?


Für beides ein "nein". Das erste heißt nur, dass der Benutzer sendet, er würde deflate und gzip akzeptieren.
Das zweite ist nur die session-Länge innerhalb von PHP, das hat mit dem Cache nichts weiter zu tun.

Du müsstest die Serverkonfiguration einsehen. Hast Du lediglich Webspace ohne Zugriff auf die config?
@Caching:
Du kannst es auch ausprobieren, indem Du die entsprechenden Zeilen entfernst und Dir über irgendeine Extension anzeigen lässt, was die Standardausgabe für die Dateien ist.
Prinzipiell ist die Cache-Zeit für statische Dokumente sowieso relativ gering, an denen ändert sich doch nicht viel - oder aktualisierst Du die CSS- und Javascript-Dateien andauernd?

Auf die gleiche Weise kann man überprüfen, ob der Server ohne die AddOutputFilterByType-Direktiven trotzdem kompirimierte Inhalte sendet. Die entsprechenden Zeilen rauslöschen und schauen, was die Header sagen.

@Pagespeed:
Dann ist mod_pagespeed nicht installiert. Also rauswerfen.

@webp & Cachify:
Dann kann/muss es natürlich drin bleiben. Hinsichtlich der webp-Geschichte würde ich aber überprüfen, ob es sich wirklich positiv auswirkt und es lassen, wenn es nicht spürbar ist.

Was bezweckst Du mit folgender Zeile?
RewriteCond %{REQUEST_URI} ^/[^\\.]+[^/]$
Das wird mir irgendwie nicht klar - wenn die Anfrage /\\. lautet, leitest Du um?

Viel mehr wird man nicht einsparen können, wenn Dir die Einstellungen wichtig sind. Brauchst Du die ganzen php_value-Einstellungen denn?


Make Seitenreport great again!

Marcus
Avatar Marcus
Guru (224 Beiträge)
am 27.07.2015, 11:07 Uhr schrieb Marcus

Hallo Mattes!

Auch für diese ausführliche Antwort erst einmal Danke. Ich versuche das mal nach besten Möglichkeiten zu beantworten.

Wenn ich den Cache- sowie den Komprimierungs-Abschnitt herausnehme, sagt Firebug folgendes:

Connection Keep-Alive
Content-Encoding gzip
Content-Type text/html; charset=UTF-8
Date Mon, 27 Jul 2015 08:49:13 GMT
Keep-Alive timeout=2, max=1000

Bezüglich einer Umleitung kann ich nur sagen, das ich auf zum einen auf die Domain ohne www. umleite, zudem hat das - wenn ich mich recht entsinne - damit zu tun, am Ende einer URL ein / anzuhängen.

Zugriff auf die Serverkonfiguration habe ich nicht - shared Hosting


Das Regional-Magazin für Lüneburg und die Region:
salzsau-panorama.de

matthes
Avatar matthes
Foren Moderator
Evil Genius
Content Halbgott (973 Beiträge)
am 27.07.2015, 15:12 Uhr schrieb matthes

Marcus schrieb:
Wenn ich den Cache- sowie den Komprimierungs-Abschnitt herausnehme, sagt Firebug folgendes:


Die Komprimierung für text/html ist aktiv, das Caching anscheinend nicht.
Für alle anderen Inhalte, die in den Cache-/Komprimierungsabschnitten stehen, müsstest Du es separat ausprobieren. Also CSS-Datei aufrufen, Header ansehen; JS-Datei aufrufen, Header ansehen; usw.

Wenn "Content-Encoding: gzip" dort steht, kannst Du es aus dem Komprimierungsabschnitt nehmen.


Make Seitenreport great again!

Marcus
Avatar Marcus
Guru (224 Beiträge)
am 03.08.2015, 13:05 Uhr schrieb Marcus

Hallo zusammen!

Jetzt habe ich ein Problem, das ich mir nicht erklären kann, aber das wohl möglich mit der Optimierung der htaccess in Zusammenhang steht.

Und zwar wird beim Klick auf die Links neben den Artikelbildern nicht auf die Artikel verlinkt, sondern man bleibt auf der Startseite.

Ich habe ansonsten nichts geändert.

Hier noch einmal die optimierte Datei

SetOutputFilter DEFLATE
AddHandler php56-cgi .php
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
php_value session.gc_maxlifetime 86400
php_flag log_errors on
php_value error_reporting E_ALL
php_value error_log /xxx/errorlog/error.log

<Files wp-login.php>
AuthName "Restricted Admin-Bereich"
AuthType Basic
AuthUserFile /xxx/.htpasswd
require valid-user
</Files>

AddType text/html .gz
AddEncoding gzip .gz
AddType image/webp .webp

Options +FollowSymlinks -Indexes

RewriteEngine On
RewriteBase /

RewriteRule ^login$ xxx/wp-login.php [NC,L]



# BEGINN CACHIFY
# GZIP FILE
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in
|comment_author)_
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cachify/%
{HTTP_HOST}%{REQUEST_URI}/index.html.gz -f
RewriteRule ^(.*) /wp-content/cache/cachify/%{HTTP_HOST}
/index.html.gz [L]

# HTML FILE
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in
|comment_author)_
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cachify/%
{HTTP_HOST}%{REQUEST_URI}/index.html -f
RewriteRule ^(.*) /wp-content/cache/cachify/%{HTTP_HOST}
/index.html [L]
# END

RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/.webp -f
RewriteRule ^(wp-content/uploads.+)\\.(jpe?g|png)$ .webp
[T=image/webp,E=accept:1]

# Hotlinking verbieten
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\\.)?salzsau-panorama
\\.de(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} !google\\. [NC]
RewriteCond %{HTTP_REFERER} !search\\?q=cache [NC]
RewriteRule \\.(gif|jpg|GIF|JPG|png|PNG)$ - [F]

RewriteCond %{QUERY_STRING} !error
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\\ /(wp-includes|
wp-content)/(.+)\\.php\\ HTTP/
RewriteRule .* - [F]

RewriteCond %{QUERY_STRING} ftp\\: [NC,OR]
RewriteCond %{QUERY_STRING} http\\: [NC,OR]
RewriteCond %{QUERY_STRING} https\\: [NC]
RewriteRule .* - [F,L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

RewriteCond %{QUERY_STRING} replytocom=
RewriteRule ^(.*)$ page_not_found.html [R=410,L]

RewriteCond %{REQUEST_URI} ^/[^\\.]+[^/]$

RewriteRule ^(.*)$ %{HTTP_HOST} [R=301,L]



# Double slashes in allen URLs verbieten
RewriteCond %{THE_REQUEST} ^[A-Z]+\\ /(([^/\\ ]+/)*)/+(
[^\\ ]*)
RewriteRule ^ /%1%3 [L,R=301]

# BEGIN Cache-Control Headers
# mod_headers.c
<filesMatch "\\.(ico|jpe?g|png|gif|swf|css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\\.(js)$">
Header set Cache-Control "private"
</filesMatch>
# <filesMatch "\\.(x?html?|php)$">
# Header set Cache-Control "private, must-revalidate"
# </filesMatch>
# END Cache-Control Headers

#ETags entfernen
# mod_headers.c
Header unset ETag
FileETag None

# mod_headers.c
Header append Vary Accept env=REDIRECT_accept


# Browsercache 1 Tag
# mod_expires.c
ExpiresActive On
ExpiresDefault "access plus 1 month 1 days"
ExpiresByType text/html "access plus 1 month 1 days"
ExpiresByType image/gif "access plus 1 month 1 days"
ExpiresByType image/png "access plus 1 month 1 days"
ExpiresByType text/xml "access plus 1 seconds"

# mod_setenvif.c
<Files xmlrpc.php>
BrowserMatch "Poster" allowed
BrowserMatch "WordPress" allowed
BrowserMatch "Windows Live Writer" allowed
BrowserMatch "wp-iphone" allowed
BrowserMatch "wp-android" allowed
Order Deny,Allow
Allow from env=allowed
</Files>

# Zugriff auf Dateien verbieten / WordPress Sicherheit
<Files wp-config.php>
order allow,deny
deny from all
</Files>

# PROTECT readme.html
<Files readme.html>
Order Allow,Deny
deny from all
</Files>

# PROTECT liesmich.html für DE Edition
<Files liesmich.html>
Order Allow,Deny
deny from all
</Files>

<Files install.php>
Order Allow,Deny
deny from all
</Files>

<files error_log>
Order allow,deny
deny from all
</files>

Redirect 301 /+ plus.google.com/xxx/about


Redirect 301 /plus plus.google.com/xxx/about


# Keine URL based exploits zulassen
RedirectMatch 403 \\[


Das Regional-Magazin für Lüneburg und die Region:
salzsau-panorama.de

bernie
Avatar bernie
Rentner
Fortgeschrittener (82 Beiträge)
am 03.08.2015, 13:21 Uhr schrieb bernie

Hallo Marcus,
kann ich nicht nachvollziehen. Ich werde ordnungsgemäß auf die jeweiligen Seiten weitergeleitet.
MfG. Bernd


https://www.berndgollin.de/



« zurück zu: Wordpress

Das Seitenreport Forum hat aktuell 5276 Themen und 36110 Beiträge.
Insgesamt sind 48343 Mitglieder registriert.