apache中的.htaccess配置示例收集整理
<IfModule mod_rewrite.c> <FilesMatch "^\d+_\d+_\d+\.zip$"> order deny,allow deny from all </FilesMatch> </IfModule> <Files ~ "^.(htaccess|htpasswd)$"> deny from all </Files> Options -Indexes order deny,allow <IfModule mod_authn_file.c> AuthType Basic AuthName "Authorization Required" AuthUserFile /etc/apache2/basic_auth_password/htpasswd.ht Require valid-user </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www2.domain.com$ [NC] RewriteRule ^(.*) http://blog.feeidc.com/ [L] </IfModule> # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> <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 <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^/server-status – [L] RewriteRule ^/uri/a_a http://blog.feeidc.com/b_a/ [R=301,L] RewriteRule ^/uri/a_b http://blog.feeidc.com/b_b/ [R=301,L] RewriteRule ^/uri/a_c http://blog.feeidc.com/b_c/ [R=301,L] RewriteRule .* http://blog.feeidc.com/ [R=301,L] </IfModule>