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

Problem in enabling my Rewrite rule

im using wamp server and i keep on encountering errors when using rewrite rules, how do i enable my rewrite rules

jason chan
jason chan
31,009 Points

I changed to xampp you can install both on your windows box.

1 Answer

Oliver Gibbs
Oliver Gibbs
9,771 Points

In the root directory (in wamp that's the www folder by default) you'll need to find a file called .htaccess, or create it if it's not there. Ensure you've set Windows to show hidden files to be able to see it. At the top of .htaccess you'll need to turn the rewrite engine on, by writing:

RewriteEngine On

Then each rewrite rule should be on a new line, here's an example to show a file called /signup.php, to a user who simply requests the /signup directory:

RewriteRule ^signup$ /signup.php

If you can be more specific in the errors you're facing I can try and help you from there?