strange trailing slash issue

Go To StackoverFlow.com

0

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!

2012-04-04 02:42
by Adam C.


2

Finally I found out that this is a bug of Apache. https://issues.apache.org/bugzilla/show_bug.cgi?id=51982

2012-04-04 21:11
by Adam C.


0

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.

2012-04-04 02:45
by Ariel
Thanks. But it does not help. Note that 'help' is a real folder, so we should not expect any redirect - Adam C. 2012-04-04 02:56
Comments can't do newlines? annoying... Updated initial answer - Ariel 2012-04-04 03:04
I think "! -f" means not file, and "! -d" means not directory. "help" is directory, so no rewrite rule applied. We are not using wordpress anyway - Adam C. 2012-04-04 13:41
Ads