Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't usually work with LAMP and am a bit stumped getting a site working locally.

The site is set up to be used via localhost:

1) http://localhost/mysite

However, the way the site files are physically on the server the root is located as such:

2) /var/www/mysite/trunk/site

I'm trying to figure out a way where I could type #1 but have apache actually looking for the files in #2 so that all of the asset/page links in the web application work.

Is mod_rewrite the solution?

If so, I'm stumped on the syntax. I have this but it won't work (due, I assume, to it causing an infinite loop)

RewriteRule ^mysite/ mysite/trunk/site 

I have a hunch I need to sprinkle on some regex?


Per badman's suggestion, I now placed this in my htaccess file:

Alias /mysite /mysite/trunk/site

I've also tried this:

Alias /mysite /var/www/mysite/trunk/site

I end up in my server logs with this error:

[alert] [client] /var/www/.htaccess: Alias not allowed here

So, clearly I'm putting this in the wrong spot. You'd think this would be something I could easily google, but oddly I can't find an example that shows me WHERE that line should live on the server.

share|improve this question

Try putting something like this in your VirtualHost configuration or into the server configuration:

 Alias /mysite /var/www/mysite/trunk/site

Once you point your alias there, be sure to create a entry for /var/www/mysite/trunk/site. More information on aliasing in Apache can be found here

share|improve this answer
likely dumb question: do I put that line in my .htaccess file? – DA. May 22 '10 at 4:22
No, it cannot be put in an .htaccess file. If you follow the link and look up the Alias directive, you will see that its context is server config or VirtualHost. Do you have access to change either of those configurations? – nabrond May 22 '10 at 14:52
@Badman...this is all on my local Ubuntu VM, so I can change whatever. I'm just a bit lost... – DA. May 22 '10 at 22:12
I'm not very familiar with Ubuntu's Apache set-up, but can try to help. What needs to be clarified? – nabrond May 24 '10 at 23:16
I'm not sure which file that 'alias' line should be placed in. – DA. May 27 '10 at 15:23

Your Answer


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.