允許大小寫模糊比對
CheckSpelling On
CheckCaseOnly On
透過.htaccess處理伺服器訊息
Options -Indexes
ErrorDocument 403 /403.php #處理如果文件有錯誤訊息則作轉址,前面放/則會指定到根目錄
ErrorDocument 404 /404.php #處理如果文件有錯誤訊息則作轉址,前面放/則會指定到根目錄
...
神奇技法-透過.htaccess的mod_rewrite實現單主機多域名多網站的方法
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com.tw$ [NC]
RewriteRule !^subfolder/ /subfolder%{REQUEST_URI} [L,NC]
此方法可以完全把該網域直接把主機下的某個目錄變成網站根目錄,不會出現目錄路徑喔!
而會出現目錄的,就是常見的301或401等重新導向,寫法如下
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com.tw$
RewriteRule ^$ http://www.yourdomain.com.tw/tw/ [L,R=301]
其他還有常用的.htaccess如下
#if file exist than open it
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ - [L]
#if directory exist than go to it
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ - [L]
重寫網址的格式範例 (重寫/acture_filder/acture_file.php?param=123) 為 /what_ever_folder/123
RewriteRule /what_ever_folder/^(.*)$ /acture_folder/acture_file.php?param=$1 [NC,L]