標籤:dir cond 錯誤資訊 virtual over 檔案 nginx index span
.htaccess檔案配置
1 <IfModule mod_rewrite.c>2 RewriteEngine On3 RewriteBase /4 RewriteCond $1 !^(index\.php|assets|system|robots\.txt) 5 RewriteRule ^(.*)$ /index.php/$1 [L,QSA] 6 7 </IfModule>
簡要說明:關鍵是這句:rewirteCond ,assets是目錄。
apache的配置:
1 <VirtualHost *:80> 2 ServerAdmin [email protected] 3 DocumentRoot "d:/mywork/m" 4 5 ServerName m.mimi.com 6 7 <Directory "d:/mywork/m"> // 這裡是項目的目錄 8 Options Indexes MultiViews FollowSymLinks 9 AllowOverride All10 Order allow,deny11 allow from all12 </Directory>13 </VirtualHost>
簡要說明:
ServerAdmin表示錯誤資訊地址,如果發生錯誤發送到這個郵箱地址。
Indexes 的作用就是當該目錄下沒有 index.html 檔案時,就顯示目錄結構,去掉 Indexes,Apache 就不會顯示該目錄的列表了。
Nginx配置幾句
1 location /2 {3 index index.php;4 if (!-e $request_filename) {5 rewrite ^/(.*)$ /index.php?$1 last;6 break;7 }8 }
codeigniter 去除index.php (nginx,apache) 通用方法