httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron W Morris <>
Subject Re: [users@httpd] Trailing slash redirect with nondefault port
Date Mon, 08 Mar 2004 22:47:45 GMT
Qwer Uiop wrote:

> I run apache as a non root user on port 8080 and forward port 80 to 8080 by firewall.
The problem is that then user enter
> http://server/dir the server (I guess it is done by mod_dir) redirects him to http://server:8080/dir/.
Is it possible to setup things in such a way that the redirect always goes to the same port
as the original request?
> Probably, I should substitute r->uri with r->unparsed_uri in mod_dir.c:handle_dir
(at least in case of no parameters). Is it right way? 

Had the same problem.  Solved with mod_rewrite:

RewriteEngine on
RewriteCond %{SERVER_PORT} ^8080$
RewriteRule ^/(.+[^/])$ http://%{HTTP_HOST}/$1/ [R]

If you are only using port 8080 on your web server, then you can safely 
remove the first rewrite condition.  Frankly, I like this better than 
using "UseCanonicalName on" since it is hostname agnostic.

Aaron W Morris <> (decep)

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message