Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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

share|improve this answer
    
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 Jan 30 '12 at 20:41
    
I was unable to get this to work, however a painless workaround was found from a backup file I got. –  victoroux Jan 31 '12 at 5:32
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.