.htaccessのファイル名を変更する

.htaccessというファイル名を変更したい場合は、以下の設定により可能になります。


スポンサーリンク

関連記事

使用した環境

.htaccessファイルをやめ別名のファイル名にする

この資料では、.htaccessファイルを.htconfigに変更してみることにします。
デフォルト値.htaccessファイル名を変更するには、AccessFileNameディレクティブ の設定値を.htconfigに変更することにより実現することができます。

httpd.confを確認すると、以下の記述があります。
(OS, Apacheのバージョンによりhttpd.confが異なる場合があるかもしれません。)

<省略>
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess
<省略>

以下のようにAccessFileName .htaccessを.htconfigに修正します。

<省略>
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htconfig
<省略>

以上、修正が完了したらApache(httpd)の再起動が必要です。


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2025-03-12 (水) 12:19:44