Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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

share|improve this answer
add comment

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

This is LAZY people HTML, for the record.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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