Solved

Is Conditional Aliasing possible?

Posted on 2006-06-08
8
272 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
.htaccess rewrite url with querystring problem 13 101
Virtual host in apache 31 102
Internal Server Error on 1&1 Apache Server running PERL 3 41
Apache module 5 46
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). #…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 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