-1

We have a site, www.domain.net running on xxx.xxx.xxx.1, we would like to have a folder/alias of www.domain.net/time redirect to the root of a site at xxx.xxx.xxx.2. How would you do this with apache directives? Examples would be awesome. Or guides.

Thank you very much in advance.

Physikal
  • 570
  • 2
  • 9
  • 22

2 Answers2

3

In the apache config in the VirtualHost section of www.domain.net add:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/time/
RewriteRule ^/$ http://xxx.xxx.xxx.2/ [R,L]

If you want to hide the URL you should use mod_proxy in the redirections (this conf is not tested):

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/time/
RewriteRule ^/$ http://xxx.xxx.xxx.2/ [P,L]

See: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

Mircea Vutcovici
  • 17,619
  • 4
  • 56
  • 83
0

<META HTTP-EQUIV="Refresh" Content="0; URL=xxx.xxx.xxx.2> (haha)

This is LAZY people HTML, for the record.

Kyle
  • 562
  • 2
  • 5
  • 16
  • Where would I put this? Under the apache virtual server directives? Or make an .html file of index.php or something and place it under /time/ ? If so, is there a cleaner way to handle it via directives? – Physikal Mar 30 '10 at 23:32
  • This? In an index.htm file actually! Yes there is a cleaner way. Put a .htaccess file in your domain root (right above your time directory) and place `Redirect /time xxx.xxx.xxx.2` – Kyle Mar 31 '10 at 00:30