.htaccess: Wichtige Konfigurationen Drucken

  • 0

Die .htaccess-Datei liegt im Wurzelverzeichnis (/public_html/) und steuert viele Server-Einstellungen.\n\nAchtung: Fehler in .htaccess führen zu einem 500 Internal Server Error.\nVor jeder Änderung: Backup der .htaccess erstellen!\n\nHäufige und nützliche .htaccess-Konfigurationen:\n\nPHP-Einstellungen überschreiben:\nphp_value upload_max_filesize 64M\nphp_value post_max_size 64M\nphp_value memory_limit 256M\nphp_value max_execution_time 300\n\nVerzeichnis-Listing deaktivieren:\nOptions -Indexes\n\nHTTPS erzwingen:\nRewriteEngine On\nRewriteCond %{HTTPS} off\nRewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]\n\nwww zu non-www umleiten:\nRewriteEngine On\nRewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]\nRewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]\n\nBestimmte Dateitypen schützen:\n\n order allow,deny\n deny from all\n\n\nBrowser-Caching für Performance:\n\n ExpiresActive On\n ExpiresByType text/css "access plus 1 month"\n ExpiresByType image/jpeg "access plus 1 year"\n ExpiresByType image/png "access plus 1 year"\n ExpiresByType text/javascript "access plus 1 month"\n\n\nGZIP-Komprimierung:\n\n AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript\n\n\nWordPress Standard-.htaccess:\n# BEGIN WordPress\n\nRewriteEngine On\nRewriteBase /\nRewriteRule ^index\.php$ - [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . /index.php [L]\n\n# END WordPress

War diese Antwort hilfreich?

« Zurück