Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Trouble with RewriteBase in htaccess

Does anyone have a solid grasp of how RewriteBase works? I'm developing multiple php websites (with MVC logic) locally and running a server with MAMP. Here's my file structure, with a directory "dev" set as my Document Root in MAMP:

dev/
]---- www/
    ]---- project1/
    ]---- project2/
    ]---- project3/

I want to set things up such that no matter what subdomain a project is in, it serves all pages and links correctly, without having to manually change all of my links within the php files themselves. I believe this is possible using htaccess and the RewriteBase directive, but I'm having no luck. Here's my htaccess file inside the project1 directory:

RewriteEngine On
RewriteRule ^about$ /about.php
RewriteBase /www/project1/

Currently, localhost/www/project1/about throws an error stating "The requested URL /about.php was not found on this server." Any ideas?