Forum Moderators: phranque

Message Too Old, No Replies

yet another trailing slash problem - apache 2.0

apache 2.0 trailing slash mod_rewrite RewriteRule

         

gashford

1:07 pm on Jun 4, 2010 (gmt 0)

10+ Year Member



Hello,

I'm a new member here, and like a lot of new members I've joined because I'm having an issue that I can't seem to resolve. I have a several clustered servers working behind a load balancer. When a client accesses our site, they see the clustered name rather than the individual server that is actually doing the work. The problem is that if a user enters a url without a trailing slash, they will be redirected to the individual server.

user enters: mybigwebsite.bobo.com/folder
user gets: servername.bobo.com/folder/

I've tried adding a RewriteRule to verride (both inside the virtual host block and in the main), but it does not seem to stick:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ [%{HTTP_HOST}$1...] [R=301,L]
</IfModule>

Notes:
- apache 2.0
- trailing slash directive is on (default)
- I have virtual hosts set up:

<VirtualHost 555.555.55.55:55>
ServerName servername.bobo.com
ServerAlias mybigwebsite.bobo.com


Any ideas, suggestions?

Thanks!

gashford

1:47 pm on Jun 4, 2010 (gmt 0)

10+ Year Member



ok ... I think I found my solution (by further searching your wonderful forum)

UseCanonicalName off

That is all, I think :)

Thanks!