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 trialSpencer Christensen
Courses Plus Student 8,180 PointsExtra Credit on "Cleaning URLs with Rewrite Rules" (PHP)
Hello,
I, being a very diligent student, have been banging away at the extra credit on Randy Hoyt's "Cleaning URLs..." to no avail. To recap, the task is:
To achieve item 1 I have implemented the following in my htaccess file:
RewriteRule ^contact/thanks/$ /contact/index.php?status=thanks
Item 2 is where I am tripping (at least I think). I have tried an assortment of the following, with no luck whatsoever:
RewriteCond %{QUERY_STRING} ^status=(thanks)$
RewriteRule ^contact/index.php$ /contact/%1/? [R=301]
RewriteCond %{QUERY_STRING} ^status=(thanks)$
RewriteRule ^index.php$ /contact/%1/? [R=301]
Any assistance would be very appreciated!!!
4 Answers
Spencer Christensen
Courses Plus Student 8,180 PointsHampton Paulk would you be able to give me a clue here?
Tunde Adegoroye
20,597 PointsI feel your pain i really do think that treehouse needs to revamp its php course at the moment at lot of things could be improved on ....
Ben Goldman
14,626 PointsSpencer,
I was having the same problem that you were. I was probably over-thinking it. I basically just did what you had done for step one, ignored doing any other rewrites, and then changed the $mail destination in the contact page from "//contact/?status=thanks" to simply "contact/thanks/". It worked like a charm.
John MacDonald
8,593 PointsJust go in the the Contact index file and edit the header location info to redirect to contact/thanks/.
Hope this helps
John; \n\n
Ben Goldman
14,626 PointsThanks, John. I was having the same problem as Spencer, and your solution worked perfectly for me.