我正在尝试在Amazon Linux实例上启用mod_rewrite。我的目录指令如下所示:
<Directory />
Order deny,allow
Allow from all
Options None
AllowOverride None
</Directory>
<Directory "/var/www/vhosts">
Order allow,deny
Allow from all
Options None
AllowOverride All
</Directory>
然后在httpd.conf中进一步查找LoadModule
指令:
... other modules...
#LoadModule substitute_module modules/mod_substitute.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule proxy_module modules/mod_proxy.so
... other modules...
我已经注释掉了Wordpress不需要的所有Apache模块。
仍然,当我发出http重新启动,然后/usr/sbin/httpd -l
仅用以下命令检查加载的模块时:
[root@foobar]# /usr/sbin/httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
在包含Wordpress网站的虚拟主机中,我.htaccess
包含以下内容:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
.htaccess由apache拥有,apache是运行该用户的用户。该apachectl -t
命令返回Syntax OK
我的/etc/httpd/conf.d/vhosts.conf
样子是这样的:
<VirtualHost *:80>
ServerAdmin foobar@gmail.com
ServerName foobar.net
ServerAlias www.foobar.net
DocumentRoot /var/www/vhosts/foobar/
ErrorLog /var/www/vhosts/foobar/logs/error.log
CustomLog /var/www/vhosts/foobar/logs/access.log combined
</VirtualHost>
我究竟做错了什么?我应该检查什么?