Internal redirect using Apache -- mod_rewrite?

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Internal redirect using Apache -- mod_rewrite?

Post 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?
jceresini
Forum Newbie
Posts: 8
Joined: Fri Mar 27, 2009 6:03 pm

Re: Internal redirect using Apache -- mod_rewrite?

Post 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
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Internal redirect using Apache -- mod_rewrite?

Post by alex.barylski »

Sweet thanks a million :)
Post Reply