Catalogue
Enabling mod_rewrite via .htaccess

Enabling mod_rewrite via .htaccess

🌐 日本語で読む

Overview

We often use mod_rewrite without giving it much thought,
but depending on the httpd configuration it may not be available.

Here is a summary of the configuration steps.

Configuration Steps

Edit /etc/httpd/conf/httpd.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
LoadModule deflate_module modules/mod_deflate.so    # ← 有効化
LoadModule rewrite_module modules/mod_rewrite.so # ← 有効化

AccessFileName .htaccess # ← 追加

DocumentRoot "/var/www/html"
<Directory "/var/www/html">
....
# Options Indexes FollowSymLinks
Options Indexes FollowSymLinks ExecCGI # ← ExecCGI追加

# AllowOverride None
AllowOverride All # ← Allに修正
....
</Directory>

Restart httpd after the changes above

1
# service httpd restart
kenzo0107

kenzo0107