Apache rewrite 設定

投稿者:

エラーログにこんなのが出た場合
Invalid command ‘RewriteEngine’, perhaps mis-spelled or defined by a module not included in the server configuration
httpd.confの以下の項目を有効にします
LoadModule rewrite_module modules/mod_rewrite.so
また.htaccessでこんな風に設定してる場合が多いから
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.html(#.*)?$ index.php?cmd=read&page=$1$2 [L]
RedirectMatch 301 ^([^.]*[^/])$ $0/
httpd.conf に以下のように記述します。
<Directory “公開ディレクトリ”>
AllowOverride All
</Directory>

Thank you for reading this post, don't forget to subscribe!