I have a folder under document_root in Apache server. When I type in http://www.example.com/help, it does not redirect to http://www.example.com/help/, but goes to http://www.exmaple.com//help/. Note that there are two slashes after the domain name.
I couldn't find any mod-rewrite rule set up for this kind of redirect. Can anyone think of any other possible reason?
Also, in Apache, redirecting from http://www.example.com/help to http://www.example.com/help/ is done by what? (Note 'help' is real folder, and there is not a file named 'help').
Thanks!
Finally I found out that this is a bug of Apache. https://issues.apache.org/bugzilla/show_bug.cgi?id=51982
First guess is that your application configuration has an item for its base URL, and in your case, it ends with /
, causing the application's internal routing system to add the extra slash.
Replying to asker comment:
Look in your .htaccess file. If it looks something like this (this is the one used by WordPress installations by default, by the way):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Then it will attempt to load from the actual directory /help
.
But if it does not contain the !-f
and !-d
lines, it will load every request via the application entry point, whether the requested item exists in the file system or not.