Take a look at this sample vhost snippet:
<VirtualHost *:80>
DocumentRoot /web/content
ServerName me.example.com
</VirtualHost>
Say /web/content contains 2 files, index.html and page.html, and a subdirectory colors containing yellow.html. index.html contains links like href="/page.html" and href="/colors/yellow.html", using / to refer to the web root.
Is there a way to internally use me.example.com/test/ as the root of the site? In other words, when a user goes to http://me.example.com/test/, I want to fetch /web/content/index.html. So, the /test/ in the URL would essentially be a dummy “folder”.
Basically, I’d like me.example.com/test to function exactly how a subdomain (say, test.me.example.com) would. Something like setting ServerName me.example.com/test (but I know that doesn’t work).
I know I could simply make a REAL folder /web/content/test and put everything in there, but that would break my links beginning with a /, as they would still refer to /web/content as the web root. The same problem arises when adding a directive like Alias /test /web/content.
Do I have any options here? Maybe using RewriteBase somehow? (I’ve tried a few things with no luck.)
Try putting this in the htaccess file in your document root
This maps the
/test/URI path to the document root. If you want to say, map it to the colors folder, you’d do: