Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have website on Apache with the following, simplistic .htaccess file:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php

I have a page at http://localhost/example. I load content-only versions of this page with this URL: http://localhost/example?content-only.

I created a directory example which caused Apache to direct AJAX requests to my URL to example's directory listing. This behavior was undesirable, so my immediate response was to move the directory to elsewhere.

However, when I try to load the page via AJAX, Apache now adds a trailing slash to the URL (resulting in this URL: http://localhost/example/?content-only). I've tried restarting Apache (on Ubuntu, if this is relevant information) but the issue persists.

This isn't mission-critical as the issue of recognizing the trailing slash version of the URL is fixable in the website's code itself. But I'm curious... What is causing this behavior?

share|improve this question
Is it adding the slash in a 30x redirect to the client, or in the apparent URL that your application code sees? –  Shane Madden Aug 25 '12 at 21:04
@ShaneMadden From Chrome Inspector: Good request / Bad request. The bad request has a trailing slash at the end of the "Request URL," though not on the Referer header. It's also worth noting that this only occurs on my local box. –  Koviko Aug 25 '12 at 21:19
add comment

Your Answer


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

Browse other questions tagged or ask your own question.