Site Setup


#1

Hi,

I’ve being trying for the past 5 hours to set up my site and I need Alias (Virtual Directories) on my system. That’s How my system works:

Ex.
/root
/sites
/site1
/site2
/assets
/etc
/com

So site1.com points to folder /root/sites/site1/
but files on this root need to access /root/assets for instance. On my local config I have: Alias /assets/ /root/assets/ and it works fine. So all I need now is to figure out how to do the same on .htaccess (no Alias allowed).

Can someone help me?

Thanks
Pedro


#2

Hi Pedro,

I’m not sure I have a solution for you, but I do have a few things to consider.

  1. Why create a new thread in the forums when you already have one going for your questions? It is unnecessary to have multiple threads, and only serves to cause confusion when answering your questions.

  2. To me it sounds like your directory structure is overly complicated. If you need to access yoursite.com/assets, why not make a directory in your websites directory and keep things simple?

  3. I don’t believe it is possible to edit the Apache configuration files at DreamHost, and I don’t know if it is possible to setup aliases through a .htaccess file, but regardless try checking the wiki: http://www.wiki.dreamhost.com/.htaccess, and you may find other information by searching through these forums.

Cheers,
LBO


#3

Hi LBO,

First of all thank you for your reply.

  1. I do apologizes for creating a new thread but I am right now desperate for a solution. I worked on this structure for more than a month to find out 1 day before going live with it that I can’t have virtual directories. That means I will have to change my structure big time and it might take another week or so to finish it.

  2. I disagree with you. The structure is quite simple. Maybe assets was a bad example. Classes would be a better one. I have multiple sites under this structure. Ex. site1.com / site2.com etc… and they share code like classes. Again assets shouldn’t be there.

  3. Yes I looked at this thread and there is nothing there. I also know that it is not possible to use Alias on .htaccess. You can only use Redirect and RedirectMatch under mod_alias.

Anyway. Thank you a lot for your reply. So far I didn’t get much help. I spent the day trying to figure out things around here. I will post the solutions I found on the other thread so I can help some lost souls like me.

Cheers
Pedro


#4

If you’re sharing classes, assets, images, etc. across domains you could setup a shared folder for each in the user’s $home and ssh in and create the relevant directories as symbolic links in the domains you want to have access to the shared content.

eg.

in domain1.com create a symbolic link called assets pointing to /home/assets

in domain2.com create a symbolic link called assets to /home/assets, a symbolic link called classes to /home/classes, a symbolic link called images to /home/images, etc.

That way an edit on one file (eg. in the classes folder) will be used by all the domains that symlink to the communal classes folder.

Maximum Cash Discount on any plan with MAXCASH


#5

Hi sXi,

That’s exactly what I am trying to do.
How do I do that?

Thanks
Pedro


#6

Figured it out.

symlink() will do the job.

You can read how to do that here:
http://perishablepress.com/press/2007/06/25/use-php-to-create-symbolic-links-without-shell-access/

OR

http://ca.php.net/manual/en/function.symlink.php

Pedro


#7

$ ln -s target link_name

Maximum Cash Discount on any plan with MAXCASH