Rewriting of ports to which users are redirected

Discuss practical ways rearrange URLs using mod_rewrite.

Postby Guest » Fri Sep 07, 2001 8:43 am

Hello all,
I have a following problem:
T he cluster runs www servcie on port 80, but the real servers run apache on port 82 (the cluster's port 80 is redirected to the real servers' port 82). The apache does some rewriting, ending with Location: , but I need to redirect users to (ie. port 80 instead of 82, but not via

Is there anyone who can tell me how to achieve this?

I've read standard documentation for mod_rewrite and URL Rewriting Guide, but I haven't been able to find a solution... :sad:

Thanks for any help or hint...


Postby antonio_danger » Sun Sep 09, 2001 8:58 pm

Hi there,

I think you want to redirect a URL to
a backend server running at port 82 .

you can even achieve this by a
ProxyPass Directive from mod_proxy .

you proxy the request from port 80 to
port 82 and serve the request back

I have tried using the rewrite module
<IfModule mod_rewrite.c>

RewriteLog "/usr/local/apache/logs/rewrite.log"
RewriteLogLevel 9
RewriteRule ^(.*) %{HTTP_HOST}$1 [C]
RewriteRule ^*)$1 [R]


This is not a correct prox mechanism.

There is another way to achieve it using
the Virtual Host Entry as in

Posts: 1
Joined: Sun Sep 09, 2001 4:00 pm

Postby orin » Mon Sep 10, 2001 1:24 am

Sorry, that's not the case. :sad:

The rewriting of to is done via Alteon switches, that means that request to apache are directed to port 82. And when there is some redirection via Location: header, it is directed to
What I want to achieve is the Location: header without the port 82, so that users send their new request to (on port 80).

But anyway, thanks for reply... :wink:
Posts: 1
Joined: Thu Sep 06, 2001 4:00 pm

Postby Brett » Mon Oct 15, 2001 7:37 am

Hi Petr,

I haven't tried the following, but they might help:

I think you can check the server port in a rewrite condition:
RewriteCond ${SERVER_PORT} ^82$

I think you can specify the server port in a rewrite rule:
RewriteRule ^(.*) $1 [env=SERVER_PORT:80]

<font size=-1>[ This Message was edited by: Brett on 2001-10-15 11:37 ]</font>
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest