apache php で rewrite がきかない。
apache 2.4.6
PHP 5.4.165
で動いているシステム(CakePHP)を同じバージョンを使用している、別のサーバに移行したのですが、
rewriteがきいてないとおもわれる現象
http://localhost/xxx/yyy
でアクセスすると、
The requested URL xxx/yyy was not found on this server.
となってしまいます。
httpd.conf に
LoadModule rewrite_module modules/mod_rewrite.so
を加えるだけでよいとおもうのですが、phpにも、なにか設定が必要でしょうか?
httpdを何度か再起動すると
error_log:[Sun Jan 07 21:10:41.810355 2018] [so:warn] [pid 6379] AH01574: module rewrite_module is already loaded, skipping
が出ているので、rewrite のモジュールはhttpdに反映されているとおもいます。
.htaccess はcakePHPで提供されるもので、私が意図的に編集、作成したものでなく中身はわかりませんが、移行されています。
調査のために、
RewriteLog /tmp/rewrite.log
RewriteLogLevel 9
という記述をhttpd.conf
以下のように、include に続いて追記
Include conf.modules.d/*.conf
RewriteLog /tmp/rewrite.log
RewriteLogLevel 9
すると
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
1月 08 01:06:33 testhost httpd[6808]: [Mon Jan 08 01:06:33.610291 2018] [so:warn] [pid 6808] AH01574: module r
1月 08 01:06:33 testhost httpd[6808]: AH00526: Syntax error on line 59 of /etc/httpd/conf/httpd.conf:
1月 08 01:06:33 testhost httpd[6808]: Invalid command 'RewriteLog', perhaps misspelled or defined by a module
1月 08 01:06:33 testhost systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
1月 08 01:06:33 testhost kill[6809]: kill: cannot find process ""
1月 08 01:06:33 testhost systemd[1]: httpd.service: control process exited, code=exited status=1
1月 08 01:06:33 testhost systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
となり、apacheを再起動できないので、はずしています。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/08 03:14
2018/01/08 04:17
2018/01/08 04:45