I'm trying to enable mod_rewrite on an Amazon Linux instance. My Directory directives look like this:
<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>
And then further down in httpd.conf I have the LoadModule
directive:
... 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...
I have commented out all the Apache modules not needed by WordPress.
Still when I issue http restart and then check the loaded modules with /usr/sbin/httpd -l
I get only:
[root@foobar]# /usr/sbin/httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
Inside the virtual host containing the WordPress site I have an .htaccess
containing:
# 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
The .htaccess is owned by apache which is the user apache runs under. The apachectl -t
command returns Syntax OK
My /etc/httpd/conf.d/vhosts.conf
looks like this:
<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>
What am I doing wrong? What should I check?
Best Answer
The LoadModule directive will load a module dynamically.
Try issuing
RewriteEngine on
in a virtual host followed byapachectl -t
to confirm weather or not the module is actually loaded.