If you want to rewrite URLs in Apache without a redirect(using internal forwarding) use the P flag at the end as below
http://localhost/foo/1 to http://moo.com/foo/1
RewriteRule /foo/(.*) http://moo.com/foo/$1 [P]
If you want to rewrite URLs in Apache without a redirect(using internal forwarding) use the P flag at the end as below
http://localhost/foo/1 to http://moo.com/foo/1
RewriteRule /foo/(.*) http://moo.com/foo/$1 [P]
If you want to make sure that your apache config file syntax is in tact without restarting apache, run this command
apache2ctl -t
Follow the following steps to set up a reverse proxy using Apache in Ubuntu:
1. Install reverse_proxy module
sudo apt-get install libapache2-mod-proxy-html
2. Install libxml if it is not already installed.
apt-get install libxml2-dev
3. Load the modules in apache2.conf file
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
LoadFile /usr/lib/libxml2.so
4. Say you want to forward all requests starting with /foo to http://moo.com then add the following to your apache2.conf file
ProxyPass /foo/ http://moo.com/
5. Bounce Apache and you are good to go.