Philip Wigg wrote:
Hi, I'm using Apache/1.3.36 and I don't have any room to change the version at the moment. I have a separate Virtual Host listening on port 8001:- <VirtualHost *:8001> DocumentRoot "/opt/apache_1.3.36/htdocs" ServerName www.example.co.uk ErrorLog /var/log/http/example_error_log TransferLog /var/log/http/example_access_log RewriteCond %{REQUEST_URI} !^/portal.* RewriteCond %{REQUEST_URI} !^/static.* RewriteCond %{REQUEST_URI} !^/graphics.* RewriteCond %{REQUEST_URI} !^/css.* RewriteCond %{REQUEST_URI} !^/cgi-bin/.* RewriteCond %{REQUEST_URI} !^/favicon.ico RewriteCond %{REQUEST_URI} !^/robots.txt RewriteRule ^(.*)$ /portal [R=301] </VirtualHost> There is a firewall which is port-forwarding from port 80 to port 8001 on the web servers. The problem is that Apache is constructing self-referential URLs with the 8001 port number. For example, it's redirecting from http://www.example.co.uk to http://www.example.co.uk:8001/portal which is not what I want, I want it to keep port 80. I have tried using 'UseCanonicalName off' inside my Virtual Host block to no avail (UseCanonicalName is turned on in the main host block). Are there any other suggestions other than writing explicit redirects? Would UseCanonicalPhysicalPort fix my issue if I were using a later version?
What happens if you just replace you last RewriteRule by RewriteRule ^(.*)$ http://www.example.co.uk/portal [R=301]By doing the [R=301], you are forcing a 301 response back to the browser anyway, so you might as well make it explicit, and it should not add any extra overhead.
Otherwise, the easiest solution would be to have your firewall forward to port 80, not 8001, and change your VirtualHost to use 80. (And maybe add another listening IP address to your server, if you need that to distinguish with another existing Apache instance on port 80).
--------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx