Alex Rivera | Logout

mod_rewrite for trailing slash problem

Asked 2008-10-01T17:47:08.780
10

I'm pulling my hair out on what should be an insanely simple problem. We are running WebSphere IHS (Apache) through an F5 BigIP. BigIP is doing the https translation for us. Our url (changed for web, not valid) is https://superniftyserver.com/lawson/portal.

When someone types in just that without the slash after portal, Apache assumes "portal" to be a file and not a directory. When Apache finds out what it is, it sends the 301 Permanent Redirect. But since Apache knows only http, it sends the URL as http://superniftyserver.com/lawson/portal/ which then creates problems.

So I tried a server level httpd.conf change for mod_rewrite, this is one of the dozens of combinations I've tried.

RewriteEngine on RewriteRule ^/lawson/portal(.*) /lawson/portal/$1

I also tried RewriteRule ^/lawson/portal$ /lawson/portal/

Among many other things... What am I missing?

Edit
Report

1 Answer

2

Try this:

# Trailing slash problem
RewriteCond    %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule    ^(.+[^/])$           https://<t:sitename/>$1/ [redirect,last]
answered 2010-12-17T18:40:20.490

Your Answer