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

PHP Enhancing a Simple PHP Application Cleaning URLs with Rewrite Rules Adding a Trailing Slash

Juan Pablo De Alba Venegas
Juan Pablo De Alba Venegas
5,022 Points

RewriteRule when I have all my code in a subfolder

what will be the syntax for a rewrite rule when I have all my files in a subfolder, for example, shirts4mike?. When I use the RewriteRule "RewriteRule ^(shirts/[0-9]+)$ /$1/ [R=301]" and I put on the browser "localhost/shirts4mike/shirts/108" send me to "localhost/shirts/108/" with an error displayed.

I try "RewriteRule ^(shirts/[0-9]+)$ /shirts4mike/$1/ [R=301]" but it didn't work