Hello,
I want to setup the following. Every request towards http://www.mydomain.com/google should be redirected towards http://www.google.com. Google is just an example taken to show the principle.
In virtualmin I did the following : Configure Websites -> Aliases and Redirects Map local to remote URLs Local URL path : /google/ Remote URL : http://www.google.be/
Map remote Location: headers to local Local URL path : /google/ Remote URL : http://www.google.be/
Seems very simple..... But I always receive the following message when browing to http://www.mydomain.com/google/ : Forbidden You don't have permission to access /google/ on this server.
Any idea how I can fix this permission issue?
It's a fresh install of Virtualmin Pro on Debian 4.0
Thanks!
Bart
so the most simple thing I do is to have a index.php in that folder and put this code in it:
[code:1]
<?php
header("Location: http://google.be/"«»); /* Send browser to www.site.tld */
exit; /* Make sure all following code does not execute */
?>
[/code:1]
you can try :
Map local to remote URLs
Local URL path : /full/path/to/google/
I don't think you need this at all:
Map remote Location: headers to local
Local URL path : /google/
Remote URL : http://www.google.be/
Ronald,
I agree that your proposed solution should work. I cannot test it at the moment from where I am located now.
There must however be a way to do the same using the apache config.... That is what rewriting an reverse proxying is meant for, no ?
Somebody has any ideas how?
Thanks!
BArt
using that piece of code will work and it's serverside, thus fast.
also look below the code i wrote
<div class='quote'>you can try :
Map local to remote URLs
Local URL path : /full/path/to/google/
I don't think you need this at all:
Map remote Location: headers to local
Local URL path : /google/
Remote URL : http://www.google.be/</div>
I tried this :
[code:1]<?php
header("Location: http://google.be/"«»);
exit;
?> [/code:1]
And it works fine. The browser is redirected to the google site.
However, let's complicate things now.
Imagine that I have a website running on an internal server 192.168.1.100.
I want to redirect everything drom http://www.mydomain.com/internal to this internal server
I cannot use above php-script as the internal server is ofc not reachable from the internet and not known by internet DNS servers.
That's where I need reverse proxying.
In virtualmin I configured this in "Server Configuration -> Proxy Paths"
URL path = /internal/
Destination URLs = http://192.168.1.100/
I see that in the apache config of my domain following is added :
[code:1]ProxyPass /internal/ http://192.168.1.100
ProxyPassReverse /internal/ http://192.168.1.100
<Proxy *>
allow from all
</Proxy>[/code:1]
This still results in the following error code in my browser when pointing to http://www.mydomain.com/internal/:
<div class='quote'>403 - Forbidden
You don't have permission to access /oxee/ on this server.
</div>
Any idea what I am doing wrong here?
Thanks for the support!
Bart
Found it!
Enabling the proxy_hhtp module did the trick!
[code:1]a2enmod proxy_http[/code:1]