Solved

Is Conditional Aliasing possible?

Posted on 2006-06-08
8
282 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
Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

 

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 125 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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