Link to home
Start Free TrialLog in
Avatar of ISBNET
ISBNETFlag for Belgium

asked on

How to redirect and hide the redirected URL

Hi,
we have a webserver running Apache 2.2.
We use Oracle Application Express (Apex), and some customers want a domain name linked to this apex url.

Now we fix it like this:
<VirtualHost 10.0.3.150:80>
      ServerName www.domain.com
      Redirect      /      http://www.domain.com/lid/test/f?p=106:102
</VirtualHost>

but when you go to www.domain.com then, the url in the address bar changes to http://www.domain.com/lid/test/f?p=106:102.
I tried fixing this using the ProxyPass directive, but without any success.

thanks for your help
Avatar of HackneyCab
HackneyCab
Flag of United Kingdom of Great Britain and Northern Ireland image

You may need to use Apache's mod_rewrite features. This will tell Apache where to look for certain requests, and Apache does so silently unless the R flag is used.

For instance, in an .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ /lid/test/f?p=1[6:102

would silently redirect all requests for the root of www.domain.com so that /lid/test/f?p=106:102 was served instead.

The mod_rewrite directives are very powerful, using regular expressions to match requests against server variables, so there's a very good chance that mod_rewrite can do what it is you need.
Avatar of PascalHeraud
PascalHeraud

Try
Redirect  permanent    /      http://www.domain.com/lid/test/f?p=106:102

or
Redirect  seeother    /      http://www.domain.com/lid/test/f?p=106:102
Pascal, those directives will tell the browser to redirect, which will cause the address in the address bar to change.
So use mod rewrite as stated before, it should be the only way to do it.
Avatar of ISBNET

ASKER

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ http://www.anotherdomain.com/lid/test/f?p=106:102

i tried this, but still the address in the address bar changes
but:
as stated in my example, the URL to mask is on another domain...
Oh yes, add the [P] option to proxify the url (need to enable the proxy module as well):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ http://www.anotherdomain.com/lid/test/f?p=106:102 [P]
Avatar of ISBNET

ASKER

i tried with the [P] option, but then i get: HTTP 404 Not found ...
Proxy module is enabled...
You may also need to enable the proxy_http module if not done already
LoadModule proxy_http_module modules/mod_proxy_http.so
Avatar of ISBNET

ASKER

LoadModule proxy_http_module modules/mod_proxy_http.so
this module was already enabled too... :(
Do you webserver has access to internet and can proxy the target address ?
This configuration works on thy apache on my PC :
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ http://www.yahoo.com [P]
I was meaning : Do the  http://www.domain.com/lid/test/f?p=106:102 URL is resolving from the server ?
Try : wget  http://www.domain.com/lid/test/f?p=106:102

Avatar of ISBNET

ASKER

okay i will use the real URL's, so it's more clear

www.imprimervotrefacture.be
should be redirected (without changing the address in the address bar) to http://www.infserv.net/lid/scoov/f?p=106:102

with wget:
C:\>wget http://www.infserv.net/lid/scoov/f?p=106:102
--11:31:49--  http://www.infserv.net/lid/scoov/f?p=106:102
           => `f@p=106%3A102'
Resolving www.infserv.net... 10.0.3.150
Connecting to www.infserv.net|10.0.3.150|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: f?p=106:102:1619196253284059 [following]
--11:31:50--  http://www.infserv.net/lid/scoov/f?p=106:102:1619196253284059
           => `f@p=106%3A102%3A1619196253284059'
Reusing existing connection to www.infserv.net:80.
HTTP request sent, awaiting response... 200 OK
Length: 5.167 (5.0K) [text/html]

100%[====================================>] 5.167         --.--K/s

11:31:50 (18.70 MB/s) - `f@p=106%3A102%3A1619196253284059' saved [5167/5167]
Avatar of ISBNET

ASKER

this is how it's configured in Apache now:
<VirtualHost 10.0.3.150:80>
ServerName www.imprimervotrefacture.be
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.imprimervotrefacture.be$
RewriteRule ^/?$ http://www.infserv.net/lid/scoov/f?p=106:102 [P]
</VirtualHost>
iks the http://www.infserv.net/lid/scoov/f?p=106:102 url also a redirect ? maybe the root cause ?
try replacing with www.yahoo.com to see if it works.

ASKER CERTIFIED SOLUTION
Avatar of PascalHeraud
PascalHeraud

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial