Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm getting a very odd redirect issue on my server. URL's without a trailing slash are being redirected to a URL with a trailing slash. The problem is that URL then redirects infinitely to itself.

e.g.: - works fine

but - redirects to which in turn causes a redirect loop

I've checked .htaccess which only contains the following:

DirectoryIndex index.php

# 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

I've been searching for 2 days for a solution to this issue. Any help would be greatly appreciated!

share|improve this question
Can you turn on a RewriteLog location and set RewriteLogLevel 9? Doesn't look like Apache should be redirecting, based on the config you've provided. – Shane Madden Mar 14 '12 at 15:52

Interesting that it's a 301 redirect and not a 302. You might be able to find the offending line with a bit of grep magic.

grep -Eir "R=301|redirect permenent" /etc/apache2/

Substitute /etc/httpd/ if you're on a RedHat-derived distro.

Failing that, it might be part of one of the PHP files. A similar grep for "header" in your DocumentRoot might find it.

share|improve this answer
Thanks for the quick response, forgive my ignorance but where would I run that code for grep? (add it .htaccess, shell, etc?) – Jonathan Mar 14 '12 at 16:17
That's a shell command. You'll want to use SSH to connect to your server and then run that. If your local machine is Windows, PuTTY seems to be the default choice of SSH client. – Ladadadada Mar 14 '12 at 16:20
Ok that's what I thought but just wanted to be sure. Just ran it and it returned nothing. – Jonathan Mar 14 '12 at 16:25

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.