Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 "/var/www/vhosts">
    Order allow,deny
    Allow from all
    Options None
    AllowOverride All

And then further down in httpd.conf I have the LoadModule directive:

... other modules...
#LoadModule substitute_module modules/
LoadModule rewrite_module modules/
#LoadModule proxy_module modules/
... 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:

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]
# 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>
     DocumentRoot /var/www/vhosts/foobar/
     ErrorLog /var/www/vhosts/foobar/logs/error.log
     CustomLog /var/www/vhosts/foobar/logs/access.log combined

What am I doing wrong? What should I check?

share|improve this question

3 Answers 3

The LoadModule directive will load a module dynamically.

Try issuing RewriteEngine on in a virtual host followed by apachectl -t to confirm weather or not the module is actually loaded.

share|improve this answer
Hi James, thanks for the answer I've added more detail to the question regarding what you pointed out. RewriteEngine is on and apachectl -t returns Syntax OK but still doesn't work. – Lorenzo Nov 5 '12 at 16:37
Sorry I deleted my last comment it was wrong. You've taken this from the wordpress .htaccess file haven't you? Do you have AllowOverride all enabled in your VHost configuration? – James Park-Watt Nov 5 '12 at 16:46
Hi James, yes I've taken it from WP. Yes the AllowOverride on the subdirectories of my DocumentRoot is set to All – Lorenzo Nov 5 '12 at 16:48
Please try this: In the server configuration - not .htaccess add the lines RewriteEngine On and RewriteRule ^.*$ [R] to confirm if rewrite is functioning at all. It should pass all traffic to the Wordpress website. – James Park-Watt Nov 5 '12 at 16:58
I deleted the .htaccess from WP and did the changes you suggested but it doesn't work. – Lorenzo Nov 5 '12 at 17:24

I just started a fresh amazon linux and had the same issue and the Options FollowSymLink were there but the next line AllowOverride None had to be changed to AllowOverride All

share|improve this answer
Thanks for the pointer. This helped me. – Punit Raizada Sep 17 '14 at 8:35
up vote 1 down vote accepted

My configuration was correct but I needed

Options FollowSymLink

in my DocumentRoot's declaration in httpd.conf for mod_rewrite to work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.