<Files *> Options -Indexes </Files> <IfModule mod_headers.c> <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=2592000, public" </FilesMatch> <FilesMatch "\.(xml|txt)$"> Header set Cache-Control "max-age=604800, public, max-age" </FilesMatch> <FilesMatch "\.(html|htm|php|shtml)$"> Header set Cache-Control "max-age=18000, max-age" </FilesMatch> </IfModule> <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ # RewriteCond %{REQUEST_URI} !\.html$ RewriteRule ^(.*)$ /$1/ [L,R=301] #RewriteCond %{HTTP_HOST} !^(m.zbphp.com|localhost|demo|192.168.) [NC] #RewriteRule ^(.*)$ http://m.zbphp.com/$1 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>
功能:
1)如果不是本地,那么绑定到 m.zbphp.com 这个域名。
2)如果访问的不是存在的文件,那么结尾没有斜杠的加上反斜杠,用于SEO
3)禁止访问log zip rar之类的文件
4)设置服务器缓存,其实这个可能会导致问题出现。
5)兼容fast-CGI的重写模式。
by default7#zbphp.com