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.


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


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

This is LAZY people HTML, for the record.

  • 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 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.