Let's say I have my web folder as public_html. In there I have a sub folder. I can view the folder at:

www.mydomain.com/sub & mydomain.com/sub

What I want is:


This will show the content of public_html/sub. How would I set up my rewrite rules to do this.

  • This seems like a duplicate of this: stackoverflow.com/questions/1167068/… - useful info available there. FWIW, my suggestion is you create another virtual host pointing directly to the sub-folder rather than incur the overhead of the apache rewrites. Feb 5, 2011 at 12:41

1 Answer 1


You don't need any rewrite rules. Just add a VirtualHost section, like

<VirtualHost IPAddress>
    ServerName sub.mydomain.com
    DocumentRoot /path/to/public_html/sub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.