Skip to content

Instantly share code, notes, and snippets.

@sergejmueller
Created December 21, 2011 14:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sergejmueller/1506173 to your computer and use it in GitHub Desktop.
Save sergejmueller/1506173 to your computer and use it in GitHub Desktop.
Beispiel einer .htaccess Datei unter WordPress
# Admin absichern
<Files wp-login.php>
AuthName "Admin-Bereich"
AuthType Basic
AuthUserFile /var/www/pfad/.htpasswd
require valid-user
</Files>
# Zugriff verweigern
<FilesMatch "(\.htaccess|\.htpasswd|wp-config\.php|liesmich\.html|readme\.html|xmlrpc\.php)$">
order deny,allow
deny from all
</FilesMatch>
# GZIP
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
# Cache für 3 Monate
<IfModule mod_expires.c>
<FilesMatch "\.(png|ico|js|css)$">
ExpiresActive On
ExpiresDefault A7776000
Header unset ETag
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
# PHP 5.3
AddHandler php53-cgi .php
# Rewrites
<IfModule mod_rewrite.c>
# Default
RewriteEngine On
RewriteBase /
# CSS
RewriteRule ^css/.+\.css$ /wordpress/wp-content/themes/playground/style.css [L]
# IMG
RewriteRule ^img/theme/(.*)\.png$ /wordpress/wp-content/themes/playground/img/$1.png [L]
# Avatare
RewriteRule ^img/gravatar/(.*)\.png$ /wordpress/wp-content/gravatar/cache/$1.png [L]
# Lose BlogID
RewriteRule ^(\d+)/$ /?p=$1 [R=301,L]
# WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment