wordpress redirect loop in wp-admin (apache compiled from source)

I recently set out to compile a lamp stack from source. Apache was compiled like so:

./configure –prefix=/srv/www –enable-mods-shared=most

Read More

and I can confirm mod_rewrite is enabled by placing this in the vhost for a site:
Redirect “/foo.html” “/bar.html”

However, after installing wordpress, I can log in at example.com/wp-login.php, but example.com/wp-admin loads to an error page about a redirect loop.

I’m using the default wordpress htaccess file:

# 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

and this vhost:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "/srv/www/htdocs/example.com"
    <Directory "/srv/www/htdocs/example.com">
    options indexes followSymLinks
            # AllowOverride controls what directives may be placed in .htaccess files.      
            AllowOverride All
            # Controls who can get stuff from this server file
            require all granted
    rewriteEngine on
    </Directory>
    <IfModule mpm_peruser_module>
            ServerEnvironment apache apache
    </IfModule>
    ErrorLog  /srv/www/logs/example.com/error_log
    CustomLog /srv/www/logs/example.com/access_log combined
</VirtualHost>
ProxyPassMatch ^/(.*.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/htdocs/example.com/$1
DirectoryIndex /index.php index.php

The ProxyPassMatch line is included to handle php via php-fpm.

I can include the httpd.conf if needed, but it’s 506 lines long and I hear pastebin isn’t received warmly here. I’ve checked the error log for that domain and it doesn’t get updated when hitting the redirect loop, and it seems like a pretty straightforward setup with the exception of using php-fpm instead of mod_rewrite, so I’m a bit lost on where to check further.

This was compiled on centos7 so a2enmod isn’t an option.

Related posts

1 comment

  1. DirectoryIndex /index.php index.php
    

    This was the issue.

    DirectoryIndex index.php
    

    This was the solution. After removing /index.php from the directoryindex directive, the site loads and the dashboard loads without issue as well.

Comments are closed.