Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

UPDATE:

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 127.0.0.1] /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

1 Answer 1

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? –  Brandon 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? –  Brandon 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

 
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.