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
Jeff Busch
19,287 PointsApache/XAMPP keeps redirecting
I am having a problem with Apache (XAMPP), I know it can't be me. I'm redoing the PHP lessons (Shirts 4 Mike). when I click on the contacts button in the header I keep getting redirected to the http://localhost/contact/ directory. I have deleted any entries for contacts in the .htaccess file(s). As you can see I have even deleted the contact directory, only to get the all to familiar "Object not found!...yadayada...Error 404". Nothing in the header.php file points to a contact directory. I can even see this at the bottom of the browser when the pointer is hovering above the link/button. I have restarted Apache and XAMPP with no success. I have even restarted my Win 8 computer. What the heck is going on here? html version?
<h4>File structure on hard drive.</h4>
<pre>
This PC\/
C:\/
\/xampp
>anonymous
>apache
>cgi-bin
>contrib
>FileZillaFTP
\/htdocs
>css
>forbidden
>img
>inc
>receipt
>restricted
>search
>shirts
>xampp
.DS_Store
.htaccess
contact.php
favicon.ico
index.php
pdostatement.fetchall.php
stylesheet.css
>img
>install
>licenses
>locale
A bunch more directories below.
</pre>
4 Answers
Jeff Busch
19,287 PointsWell I deleted all the project (Shirts 4 Mike) files and put some different Shirts 4 Mike files in the htdocs directory and Apache seems to be working properly, so we'll just see how it goes. I must have missed something.
August Whitlock
1,632 PointsI'm not sure what you issue is or how to solve it. Maybe If I could see the structure itself, that would be different. Put one thing I could point out is, that you don't need all the files that they give you to work on the Shirts 4 Mike website. I would remove everything expect the index.html (which you should convert to index.php for the class), and the css file for the styles, and of course the image files. Make sure that all that stuff is in you project folder, which should be named shirts4mike at the time of download. The place that file in you htdocs. It should work. But you shouldn't create directories for each page that you make for the website. That, at least to me, is what it sounds like you did.
Jeff Busch
19,287 PointsHello August,
Thanks for taking the time to respond. No, I never created any new directories in htdocs. I would download the project zip file from Treehouse and then move the project files and directories, as is, to the htdocs directory. At one point during the lesson we were shown how to do redirecting using the .htaccess file. After I completed the course I decided to do it over. At the beginning of the lesson there is no contact directory being used. Nor is there any reference to a contact folder in the project files. Yet when I click on the link for contact.php (ie. <li class="contact"><a href="../contact.php">Contact Us</a></li>) the URL bar in the browser displays "localhost/contact/" instead of "localhost/contact.php". Even when I type "localhost/contact.php" I still get redirected to "localhost/contact/". For some reason Apache thinks it is supposed to redirect my request.
Jeff
August Whitlock
1,632 PointsCool, I'm glad you got things up and running. I do tend to see that resets help alot. I just had a situation in which I changed some CSS in a script file and the result didn't show in the browser until I closed the browser completely and reloaded the page. It must be, then, something with Xampp, because that's the server I'm currently using.