Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Is Conditional Aliasing possible?

Posted on 2006-06-08
8
Medium Priority
?
294 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

618 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