Forum Moderators: phranque

Message Too Old, No Replies

URL Redirect

         

rajrait

9:36 am on Aug 9, 2007 (gmt 0)

10+ Year Member



Hi,

I have Apache 2.2 and i am trying to implement apache redirect request to a JBoss server. Now wht's happening is that whenever some hits www.#*$!#*$!.com it very well gets redirected to the desired [aaa.aaa.aaa.aaa:8080...] but the thing is the whole [aaa.aaa.aaa.aaa:8080...] link is displayed instead of the URL www.#*$!#*$!.com

Is it possible to hide the whole IP and the contents and just display www.#*$!#*$!.com, while the user browses the site, here is my Virtual host directive.

<VirtualHost #*$!.#*$!.#*$!.#*$!:80>
ServerAdmin webmaster@#*$!#*$!.com
DocumentRoot "/var/www/html"
Options Indexes FollowSymLinks
ServerName www.#*$!#*$!.com
ErrorLog logs/#*$!#*$!.com-error_log
Redirect / [aaa.aaa.aaa.aaa:8080...]
</VirtualHost>

Please let me something on how to achieve this.

Thanks.

Rajendra.

jdMorgan

4:45 pm on Aug 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use mod_rewrite instead of mod_alias. This will allow you to do an internal rewrite or a reverse proxy throughput instead of an external redirect. The definition of an external redirect is that the server sends a response to the client telling it to re-request the desired resource at a new URL. This terminates the current HTTP transaction. It is then up to the client to re-request the resource at the new URL given in the server's redirect response. If the client is a browser, then it will update its address bar to show this new URL.

In contrast, an internal rewrite simply changes the filepath associated with a requested URL-path, and is transparent to the client.

As an alternative to using mod_rewrite, you could also use mod_proxy. The mod_rewrite approach is better if you wish to make the rewrite highly conditional, since the RewriteCond directive may be used to test various characteristics of the requested URL and the values of current server variables. However, many of these possible conditions can also be handled by enclosing mod_proxy code in <Directory>, <Location>, or other containers as well, so using mod_proxy may be simpler.

Note that you need *only* a reverse proxy function to do this. Opening a forward proxy is not required, and should be avoided unless absolutely necessary; Enabling a forward proxy brings in many security concerns and requires the attention of a security expert.

See mod_alias, mod_rewrite, and mod_proxy documents at httpd.apache.org [httpd.apache.org].

Jim