mod_rewrite directory path to deeper directory

Posted by DA. on Server Fault See other posts from Server Fault or by DA.
Published on 2010-05-22T03:35:50Z Indexed on 2010/05/22 3:41 UTC
Read the original article Hit count: 251

Filed under:

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?

© Server Fault or respective owner

Related posts about mod-rewrite