views:

852

answers:

3

Hi,

Trying to redirect a URL on one webserver on my LAN to another webserver on my LAN. I assumed that all I needed was a .htaccess file in my /var/www directory whose contents are the following 3 lines only:

Options +FollowSymLinks

RewriteEngine on

RewriteMatch newsite\.level2\.level1\.com http://192.168.0.250:8080

Also I created a symbolic link in folder /etc/apache2/mods-enabled to /etc/apache2/mods-available/rewrite.load

1st: When I enter "newsite.level2.level1.com" in browser I end up at "level2.level1.com" 2nd: Does RewriteMatch support ports appended to the new URL

Should mention that level2.level1.com is thru DynDns.org as I have Comcast and the function to allow *.level2.level1.com is enabled

Thanks for looking, Rich

+1  A: 

Rewrite rules apply against the path part of the URL, not the host part. You control the host part of the matching by putting the rewrite rules inside appropriate <VirtualHost> containers.

You can redirect to another host, but the rule you've got is never going to match.

If you want to redirect all requests, try something like

  RewriteEngine On
  RewriteMatch .* http://192.168.0.250:8080/
genehack
A: 

Thanks genehack! I will check it out.

A: 

You can use mod_proxy for this:

ProxyPass / http://192.168.0.250:8080/
ProxyPassReverse / http://192.168.0.250:8080/