Hallo,
wie kommt der Response Header für Dateien im Verzeichnis /wp-content/uploads/ zustande? Mir war aufgefallen, dass ein .png aus dem Verzeichnis /wp-content/themes/graphene/images/ mit diesem Header gesendet wird:
[COLOR=#000000]HTTP/1.1 200 OK =>
[/COLOR][COLOR=#000000]Date => Tue, 14 Apr 2015 11:46:37 GMT
[/COLOR][COLOR=#000000]Server => Apache/2.2.15 (CentOS)
[/COLOR][COLOR=#000000]Last-Modified => Mon, 02 Feb 2015 14:56:34 GMT
[/COLOR][COLOR=#000000]ETag => "24417a8-84d-50e1c291302b9"
[/COLOR][COLOR=#000000]Accept-Ranges => bytes
[/COLOR][COLOR=#000000]Content-Length => 2125
[/COLOR][COLOR=#000000]Cache-Control => max-age=604800
[/COLOR][COLOR=#000000]Expires => Tue, 21 Apr 2015 11:46:37 GMT
[/COLOR][COLOR=#000000]Connection => close
[/COLOR][COLOR=#000000]Content-Type => image/png[/COLOR]
Dieselbe Datei manuell ins Verzeichnis /wp-content/uploads/2014/12/ hochgeladen, wird mit diesem Header gesendet:
[COLOR=#000000]HTTP/1.1 200 OK =>
[/COLOR][COLOR=#000000]Date => Tue, 14 Apr 2015 11:59:24 GMT
[/COLOR][COLOR=#000000]Server => Apache/2.2.15 (CentOS)
[/COLOR][COLOR=#000000]Cache-Control => private, max-age=1209600
[/COLOR][COLOR=#000000]Expires => Tue, 28 Apr 2015 11:59:24 GMT
[/COLOR][COLOR=#000000]Content-Length => 2125
[/COLOR][COLOR=#000000]Connection => close
[/COLOR][COLOR=#000000]Content-Type => image/png[/COLOR]
In keinem der Verzeichnisse liegt eine .htaccess, außer im Root Verzeichnis. Dort steht folgendes:
# BEGIN WPSuperCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTPS} on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]
</IfModule>
# END WPSuperCache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
#START Adaptive-Images
#Add any directories you wish to omit from the Adaptive-Images process on a new line.
#Omit plugins, wp-includes and wp-admin content.
RewriteCond %{REQUEST_URI} !wp-content/plugins
RewriteCond %{REQUEST_URI} !wp-includes
RewriteCond %{REQUEST_URI} !wp-admin
RewriteCond %{REQUEST_URI} !wp-content/themes/graphene
#Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above directories
#to adaptive-images.php so we can select appropriately sized versions
RewriteRule .(?:jpe?g|gif|png)$ adaptive-images.php
#END Adaptive-Images
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# START Browsercaching #
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType application/pdf "access 1 week"
ExpiresByType application/json "access 1 week"
ExpiresByType text/x-javascript "access 1 week"
ExpiresByType application/x-shockwave-flash "access 1 week"
ExpiresByType image/x-icon "access 1 week"
ExpiresDefault "access 2 days"
</IfModule>
# END Browsercaching #
<IfModule mod_deflate.c>
SetEnvIfNoCase Request_URI \.gz$ no-gzip
AddOutputFilterByType DEFLATE application/json
</IfModule>
Alles anzeigen
Mit den Regeln in der htaccess kenn ich mich nicht so aus. Kann dort aber keinen Hinweis auf die Header Frage finden.
Hab ich was übersehen? Eine php Datei von Wordpress kann doch nicht für den Header verantwortlich sein, solange ich die URL direkt im Browser aufrufe, oder? Dann müsste es eine Konfiguration des Servers sein, oder? Wie komm ich da weiter?
Letztendlich versuche ich für alle Dateien ein "Last-Modified" zu senden. Aber das nur nebenbei. Geht mir jetzt erstmal darum, die Grundlagen zu verstehen.