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 Introducing Rewrite Rules

Urgent help required pls

I feel more comfortable using a shirts4mike subfolder to hold my entire project. I understand I have to adjust the BASE_URL and ROOT_ULR in the config file which I have done

define("BASE_URL","/shirts4mike/");
define("ROOT_PATH",$_SERVER["DOCUMENT_ROOT"] . "/shirts4mike/");

everything works fine except for the shirts.php and the shirts.php file. When I click on the shrts button in the header i get an "Object Not Found; Error 404 message" but the search and contact are fine. I can search for shirts to without an error and I can see them on the home page but when I click on the shirt I get the same error...

....Can someone please graciously be my saviour and help me fix and identify this problem!!!!

2 Answers

Andrew McCormick
Andrew McCormick
17,730 Points

check out toward the end of the video around the 7.39 mark and make sure you have made adjustments to use your new BASE_URL on your links

I re-watched the videos and I am sure no other links need to be adjusted . At this time the shirt.php is not loading at all.

I am pretty sure I have to adjust the htaccess file to make this work. The corrections I hav tried havent worked

this following adjustment in the htaccess file:

RewriteRule ^shirts4mike/shirts/$ shirts4mike/shirts/shirts.php RewriteRule ^shirts4mike/shirts/([0-9]+)/$ shirts4mike/shirts/shirt.php?id=$1

removes the error but once i click the shirts button in the header I am transfered to the directory redirect page (white screen) that shows the two pages shirt.php ; shirts.php

Index of /shirts4mike/shirts

[ICO] Name Last modified Size Description [PARENTDIR] Parent Directory -
[TXT] shirt.php 2013-06-05 10:32 2.3K
[TXT] shirts.php 2013-06-05 10:45 1.7K
Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9 Server at localhost Port 80