?
Solved

Is Conditional Aliasing possible?

Posted on 2006-06-08
8
Medium Priority
?
289 Views
Last Modified: 2010-03-04
I'm using Apache 2.2
I've created 2 Virtual sub hosts.

I want one to be used for my live www and the other for internal testing, so I call it test.

DocumentRoot for www =  /usr/local/apache/htdocs/www
DocumentRoot for the test site = /usr/local/apache/htdocs/test

Ideally I'd like to have the test site identical to the live site except for files I add to it or change.

If under the test site, for example, I use     Alias /images/ /usr/local/apache/htdocs/www/images/

then when I access http://testsite/images/ all my live site images come up fine. But now what I want to do is create a system where is I put an actual directory under test ...ie  /usr/local/apache/htdocs/test/images ... I want files in that directory to be used if they're present. So I can change a file in the test environment and see it from that site without having to duplicate the entire site or directories.
0
Comment
Question by:dltjdt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
8 Comments
 
LVL 6

Expert Comment

by:philjones85
ID: 16871370
if you're using virtual hosts, you should have two separate mappings to the "/images/" folder

<VirtualHost *:80>
    ServerAdmin you@email.com
    DocumentRoot /usr/local/apache/htdocs/www
    ServerName domain.com

    <Directory "/">
        AllowOverride All
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
    Alias /images/ "/usr/local/apache/htdocs/www/images/"
    <Directory "/usr/local/apache/htdocs/www/images">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin you@email.com
    DocumentRoot /usr/local/apache/htdocs/test
    ServerName test.domain.com

    <Directory "/">
        AllowOverride All
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
    Alias /images/ "/usr/local/apache/htdocs/test/images/"
    <Directory "/usr/local/apache/htdocs/test/images">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 16897811

dltjdt  - are you asking that if the file exists in test, use that one, otherwise use the one that is in the live site?
0
 

Author Comment

by:dltjdt
ID: 16908503
Yes.... What Periwinkle said!
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Author Comment

by:dltjdt
ID: 16908511
But I'm hearing that this isn't possible. Does anyone know of a method that gets close to this affect? I've already set up the subhosts and I'm currently syncing between the two, but would prefer to simply copy the files that have changed once we QC that only those file exist on the test site.
0
 
LVL 6

Expert Comment

by:philjones85
ID: 16908517
why not make the "live site" icons folder a link to the "test site" icons folder?
0
 
LVL 15

Accepted Solution

by:
periwinkle earned 500 total points
ID: 16910780
Actually, I believe that you CAN do this via mod_rewrite;  see:

http://httpd.apache.org/docs/2.2/misc/rewriteguide.html

and look at the section entitled:

Search pages in more than one directory

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question