ubuntu 18.04 apache 目錄啟用並開啟.htaccess 覆寫
Temperature: 0 °C
.htaccess是在Apache HTTP Server這款服務器架設軟件下的一個對於系統目錄進行各種權限規則設置的一個文件,存在於Linux操作系統中。
比較常見的是定義默認首頁名 稱,404頁面,301轉向,等。
啟用apache 的 mod_rewrite 模組
# sudo a2enmod rewrite
重新啟動apache,重新讀取模組,設定才會生效
# sudo service apache2 restart
使用vi編修apache2.conf
# sudo vi /etc/apache2/apache2.conf
將原先 AllowOverride None 修改為 All

Options Indexes FollowSymLinks
AllowOverride All
Require all granted
重新啟動apache,重新讀取設定檔,設定才會生效
# sudo service apache2 restart