Page 1 of 1

Internal redirect using Apache -- mod_rewrite?

Posted: Fri Mar 27, 2009 11:26 am
by alex.barylski
I have a master directory whihc houses all our source code and unfortunately two applications were installed within this directory:

1. WordPress blog
2. Live help

These are stored in the docroot directory as:

/blog
/help

and sit alongside dozens of files and folders.

Everytime the developers upload the test site onto the live server -- I fear the WordPress or Live Help will stop working because something gets reset or overwritten with changes made to the original source -- this has happened a few times.

Can I remove these applications physically from the docroot but have apache still resolve the request:

http://www.domain.com/help
http://www.domain.com/blog

To somewhere like:

/var/webapps/

As opposed to having them sit in the docroot with other files which are part of our SVN setup, etc...

/var/www.domain.com/blog
/var/www.domain.com/help
/var/www.domain.com/index.php
/var/www.domain.com/about.php
/var/www.domain.com/classifieds.php
/var/www.domain.com/forums.php

Make sense? Is this possible? What would I add to the .htaccess file in the docroot?

Re: Internal redirect using Apache -- mod_rewrite?

Posted: Fri Mar 27, 2009 6:39 pm
by jceresini
You can setup aliases in the httpd.conf virtual host like follows:

Code: Select all

<VirtualHost [server_ip]:80>
        [...]
        Alias /blog/ "/var/webapps/blog"
        Alias /help/ "/var/webapps/help"
        DocumentRoot /var/www/html
        [...]
</VirtualHost>
 

Joe Ceresini
Network Engineer
jceresini@hostmysite.com
HostMySite.com

Re: Internal redirect using Apache -- mod_rewrite?

Posted: Mon Mar 30, 2009 12:32 pm
by alex.barylski
Sweet thanks a million :)