資料載入中

胡言亂語

Ubuntu環境下apache 目錄啟動.htaccess 功能

.htaccess 檔案是目錄層面的設定檔,可以對目錄變更 Apache 的設定。
要使用 .htaccess 檔案,需要在 Apache 的設定檔 (httpd.conf 或 apache2.conf) 開啟使用,否則 Apache 是不會處理 .htaccess 的設定的。
Ubuntu 環境下路徑需編輯 /etc/apache2/apache2.conf
$ sudo vi /etc/apache2/apache2.conf

找到以下字串
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>


AllowOverride None

更改為
AllowOverride All

後儲存,重啟Apache讓設定檔生效
sudo service apache2 restart


Ubuntu環境下apache目錄啟動htaccess功能
以上紀錄~


 

  • .htaccess 檔案的使用方法
  • Apache 設定檔的編輯步驟
  • Ubuntu 環境下的 Apache 設定
  • 如何啟用 .htaccess 檔案
  • 重啟 Apache 讓設定生效
https://innstory.com/story-Ubuntu環境下apache目錄啟動htaccess功能-2536

上一篇
 PHP運算次方pow()函数

下一篇
htaccess與RewriteEngine一起使用時500內部服務器錯誤 

發表留言

  • 聽起來這些設定對於網站運行很重要,特別是關於 .htaccess 檔案的部分。感覺要小心處理,不然可能會影響整個網站的功能。
    2025-12-15 下午 2 點回覆

作者簡介

離不開電腦的宅男


推薦閱讀

作者其他相關類別故事

ajax錯誤訊息提示

ajax錯誤訊息提示

Mark Chang 7 年又 205 天 1.3K

ajax目前已經是我寫系統使用非常普遍的方式~ 雖說常寫,但偶爾還是會有鬼打牆的時候發生.......

ubuntu 18.04  apache 目錄啟用並開啟.htaccess 覆寫

ubuntu 18.04 a…

Mark Chang 5 年又 251 天 2K

.htaccess是在Apache HTTP Server這款服務器架設軟件下的一個對於系統目錄進行...

PDO PHP - PDOException - Numeric value out of range 1264 Out of range value for column user_ip at row 1

PDO PHP - PDOE…

Mark Chang 5 年又 63 天 1.5K

最近遇到一個問題,一個Mysql的錯誤訊息。 我想要紀錄一個IP資訊,我會先用以下方式擷取用戶端使用...