Setting up Vhosts or .Htaccess file to shorten links in site development under Snow Leopard

0

I have a synced folder that multiple people develop on and it's located at /Users/myname/Sites/SharedCloud, which I access at localhost/~myname/SharedCloud/ and sometimes going through the project name and version can lead to a hefty link length.

I'm trying to find out how to set up a vhost so that I cat remove ~myname from the link or any other number of folders so that if I type: localhost/tempProj1 it'll take me to the folder I'm currently working on.

I've tried all sorts of things today, even trying to set up my own .dev site through hosts files and etc (led to a Forbidden error). Followed a lot of guides, no help. Checked a lot of questions on here, no help. So now I'm asking my own Q!

I'm very noob to apache and troubleshooting and have minimal experience with htaccess, but I'm positive I can't remove ~myname from a link using only the htaccess file and would appreciate any help on the matter. And this isn't a very crucial problem for me, just an annoyance I'd like sorted out if possible. (I know this worked on my Lion install, but now I'm back to a Snow Leopard machine)

UPDATE:

I found my own answer. After having set vhosts and httpd under apache, I simply added

Alias /proj1 "/Users/myusername/Sites/long/path/directory"

to my httpd-vhosts.conf file, restarted my apache, and was able to point myself to localhost/proj1 to greatly shorten my keystrokes.

victoroux

Posted 2012-01-30T19:29:38.817

Reputation: 251

Answers

0

I found my own answer. After having set vhosts and httpd under apache, I simply added

Alias /proj1 "/Users/myusername/Sites/long/path/directory"

to my httpd-vhosts.conf file, restarted my apache, and was able to point myself to localhost/proj1 to greatly shorten my keystrokes.

victoroux

Posted 2012-01-30T19:29:38.817

Reputation: 251

0

Something like this worked for me with the preinstalled Apache on 10.7 and 10.6.

  1. Uncomment Include /private/etc/apache2/extra/httpd-vhosts.conf in /private/etc/apache2/httpd.conf
  2. Add 127.0.0.1 localhost testsite.dev to /etc/hosts
  3. /etc/apache2/users/username.conf:

    NameVirtualHost *:80
    
    <Directory "/Users/username/Sites/">
        Options Indexes MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    
    <VirtualHost *:80>
        DocumentRoot "/Users/username/Sites/testsite/"
        ServerName testsite.dev
    </VirtualHost>
    
  4. sudo apachectl restart

Lri

Posted 2012-01-30T19:29:38.817

Reputation: 34 501

This is basically what the web tells me as well. For me this leads to error - Forbidden. I will try this on an empty folder or some other "fresh" setting area and get back to you. – victoroux – 2012-01-30T20:41:05.720

I was unable to get this to work, however a painless workaround was found from a backup file I got. – victoroux – 2012-01-31T05:32:11.707