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 trialEvan Shellborn
4,827 PointsNot modifying Query String
I have everything for the rewrite rules working, except when I go to the old URL for the tshirts page, it still loads and doesn't redirect. ("http://localhost/tshirt/shirts/shirt.php?id=103"). Other than that everything works fine. I can't figure out what's going on. I've emptied my browser's cache and restarted my MAMP server.
Here's my .htaccess file:
RewriteEngine On
RewriteRule ^shirts/$ /tshirt/shirts/shirts.php
RewriteRule ^shirts/([0-9]+)/$ /tshirt/shirts/shirt.php?id=$1
RewriteRule ^receipt.php$ /tshirt/receipt/ [R=301]
RewriteRule ^contact.php$ /tshirt/contact/ [R=301]
RewriteRule ^shirts.php$ /tshirt/shirts/ [R=301]
RewriteRule ^(shirts/[0-9]+)$ /tshirt/$1/ [R=301]
RewriteCond %{QUERY_STRING} ^id=([0-9]+)$
RewriteRule ^shirt.php$ /tshirt/shirts/%1/? [R=301]
amirsalehi
24,667 PointsHiya,
I think, If you have following BASE_URL and ROOT_PATH constants in your config.php file
define("BASE_URL", "/tshirt/");
define("ROOT_PATH",$_SERVER["DOCUMENT_ROOT"] . "/tshirt/");
Then you should get rid of /tshirt in your .htaccess file.
Evan Shellborn
4,827 Pointsamirsalehi, Thanks for your response. I already have my config file set up like that, though.
Ricardo Silitonga
3,668 PointsRicardo Silitonga
3,668 PointsSame problem as you. How to redirect shirt.php?id=101 if we work in shirts4mike_local folder?