.htaccess文件的正確編寫方式

今天在windows系統編寫了一個.htaccess文件, 發現在apache中開放了 modules/mod_rewrite.so以及將AllowOverride None 修改成AllowOverride All. 但訪問還是會出現:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

異常. 這讓我感到非常不解.異常的苦惱.然後在Google, baidu,.com上搜索各種答案, 然並卵.所有的答案都指向開放mod_rewrite.so和修改 AllowOverride None.
由於我本人非常喜歡用Mac電腦, 但是我本人是做Java的,公司沒有給配置Mac電腦, 但是我創建文件的習慣一直都是 Mac系統上的UTF-8格式的文件.才導致我出現的這個錯誤.我現在就把創建.htaccess文件的步驟以及注意一一道來.
第一步:
開放 modules/mod_rewrite.so
第二步:
將AllowOverride None 修改成 AllowOverride All
第三步:
檢查創建的.htaccess文件的格式, 必須一定要與你的系統是一樣的. 如果是windows,你的文件就一定要是widnows,如果是Linux就一定要是Linux的.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章