• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

AliasMatch & Alias problem (impossible to do?)

I have a linux directory structure where my client folders are like:
/www/html/clients/joe
/www/html/clients/jack
(www.domain.com/clients/joe)

and with an entry such as:
Alias /goto/ /home/virtual/site7/fst/var/www/html/clients/

I can access the client directories as
www.domain.com/goto/joe
www.domain.com/goto/jack

This is all fine, but I want to be able to have them show up as subdirectories like:
www.domain.com/joe
www.domain.com/jack

without screwing up the rest of the site. When I try to do a Alias remap to the root, the rest of the website doesn't work because the files and directories at webroot are not found anymore.

Question:
Is there a way with AliasMatch or some other means (using regex) to see the client folders under the webroot without messing up the rest of the website? Maybe this is impossible. I just don't know.

Thanks!
0
arievandenberg
Asked:
arievandenberg
2 Solutions
 
wesly_chenCommented:
Hi,

   Make the soft links from /home/virtual/site7/fst/var/www/html/clients/ to your DocumentRoot directory.
And make sure the "Options" of the DocumentRoot have "FollowSymLinks".
0
 
arievandenbergAuthor Commented:
<Directory /home/virtual/site7/fst/home/*/public_html/>
      Allow from all
      AllowOverride All
      Order allow,deny
      Options FollowSymLinks #doesn't help
</Directory>

#this works fine (www.domain.com/goto/joe)
Alias /goto/ /home/virtual/site7/fst/var/www/html/clients/joe

but

#GOAL - (www.domain.com/joe)
#PROBLEM - this breaks all docs and dirs in root. ("Not Found")
Alias / /home/virtual/site7/fst/var/www/html/clients/
0
 
wesly_chenCommented:
> <Directory /home/virtual/site7/fst/home/*/public_html/>
>      Options FollowSymLinks  
>      Allow from all
>      AllowOverride All
>      Order allow,deny
> </Directory>
This is not "DocumentRoot" directive. It is for
http://www.domain.com/~joe

> Alias / /home/virtual/site7/fst/var/www/html/clients/
Comment out this line.

Then
ln -s /home/virtual/site7/fst/var/www/html/clients/*  /path-to-document-root
/etc/init.d/httpd restart
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!

 
arievandenbergAuthor Commented:
That looks like it's almost working, except that the URL query returns a 403 Forbidden.

I changed the owner to admin7, but that didn't fix it.

I tried adding a line to this
      <Directory /home/virtual/site7/fst/home/*/public_html/>
            Allow from all
            AllowOverride All
            Order allow,deny
Options +followSymLinks
      </Directory>

but that didn't solve the problem. What am I don't wrong?
0
 
wesly_chenCommented:
Is <Directory /home/virtual/site7/fst/home/*/public_html/> the  "DocumentRoot" in httpd.conf?
If not, then it won't work!!!
0
 
wesly_chenCommented:
<Directory /home/virtual/site7/fst/home/*/public_html/>
is for
http://www.domain.com/~joe
not
http://www.domain.com/joe

If you are talking about
http://www.domain.com/~joe
then you need "UserDir"
------------------
<Directory /home/virtual/site7/fst/home/*/public_html/>
     AllowOverride FileInfo AuthConfig Limit
     Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
     <Limit GET POST OPTIONS PROPFIND>
         Order allow,deny
         Allow from all
     </Limit>
     <LimitExcept GET POST OPTIONS PROPFIND>
         Order deny,allow
         Deny from all
     </LimitExcept>
</Directory>
UserDir /home/virtual/site7/fst/home/*/public_html    # <=====
0
 
arievandenbergAuthor Commented:
No, I don't need /~joe, I just want to shadow whatever is in /clients to the root of the website, such as

www.domain.com/clients/joe
to be accessed as
www.domain.com/joe

My virtual conf file reads:
DocumentRoot /home/virtual/site7/fst/var/www/html

It might just be easier if I send you the conf file. Email me at arie@cincyring.com if you wish. Thanks for the help.
0
 
wesly_chenCommented:
1. As root, make symbolic links
ln -s /home/virtual/site7/fst/var/www/html/clients/*  /home/virtual/site7/fst/var/www/html

2.
DocumentRoot "/home/virtual/site7/fst/var/www/html"
<Directory />
      Options FollowSymLinks
      Allow from all
      AllowOverride All
      Order allow,deny
</Directory>

3. Restart httpd

4. Forget about
Directory /home/virtual/site7/fst/home/*/public_html/
0
 
arievandenbergAuthor Commented:
I tried everything you suggested, shelled into the server as root, setup a test

/home/virtual/site7/fst/var/www/html/map/test/index.htm

then
[root@dedicated root]# ln -s /home/virtual/site7/fst/var/www/html/map/*  /home/virtual/site7/fst/var/www/html

and the URL (domain.com/test) request always says
(403) You don't have permission to access /test/index.htm on this server.

What am I doing wrong? This is giving me a headache. Seems like a very standard thing to do. Like I said, if you saw the whole conf file, it might be easier. I'll send it to you.
0
 
macker-Commented:
It sounds like FollowSymLinks is not being respected, since the error is 403 rather than 404.  Symlinks are globally readable by default, so the "owner" of the symlink should not matter.  Based on the directory paths, this sounds like Ensim, and that may be part of the reason for your difficulty.

It's quite probable that FollowSymLinks is either not being set properly, or is being over-ridden.  It may be possible to create an .htaccess file with this setting.. if so, that may make things easier.

Also it should be noted that the symlink solution will only work for those directories that have had symlinks created.  I.e. if you create a directory for "jill", it will not be mapped until you create a symlink for it.  It sounds like that's something you wanted, but I don't see an easy way to address it, without geting into complex rewrite rules.
0
 
wesly_chenCommented:
> (403) You don't have permission to access /test/index.htm on this server
ls -ald /home/virtual/site7/fst/var/www/html/map/test
ls -al /home/virtual/site7/fst/var/www/html/map/test/index.htm

Check the permisson.
0
 
idmiskCommented:
check directory(!) permissions for /home, /home/virtual and all below. it they are not owned by user running apache, the you need read and exec rights for all of them

-michael
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now