apache htaccess 一个 例子
<Files ~ "^.(htaccess|htpasswd)$"> deny from all </Files> DirectoryIndex index.html #Redirect permanent /index.html http://www.bcet.com.cn/index.html #Redirect permanent /admin.html http://www.bcet.com.cn/zkdg/public/admin.html #Redirect permanent /admin http://www.bcet.com.cn/zkdg/public/admin.html #错误页面 ErrorDocument 404 /htmlPage/404.html ErrorDocument 400 /htmlPage/404.html ErrorDocument 500 /htmlPage/404.html ErrorDocument 503 /htmlPage/404.html order deny,allow <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?bcet.com.cn$ RewriteRule ^(\s*)$ /index.html [L] #L 代表匹配了此项后,停止匹配其他项
#这里代表如果页面或者资源未找到 就去 /zkdg/public/目录寻找。 #RewriteCond %{REQUEST_URI} !^/zkdg/public/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ /zkdg/public/$1 #RewriteCond %{HTTP_HOST} ^(www.)?show.wordcms.cn$ #RewriteRule ^(/)?$ 目标目录名/index.php [L] </IfModule>