Perpetual Object not found error where htaccess file exists

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Perpetual Object not found error where htaccess file exists

Postby ddr » 29. April 2009 05:37

I have had xampp working fine for quite some time now. Today it was working, and I saved a .htaccess file that in effect password protects a directory, and a .htpasswd file with the required password. After doing that all directories with an htaccess file no longer load the default file (index.php), whereas those directories that do not have an htaccess file load fine. These issues persisted even after deleting the new htaccess and also new htpasswd files. After a bit of research I found that this is the default behavior if mod_autoindex is not installed, but the httpd.conf file in the apache/conf directory says otherwise and this is confirmed by a phpinfo() function call. Any ideas as to what I did and how to fix it would be very helpful. Specific details and a play by play follow:

1. Everything was working fine.
2. I placed this .htaccess file into c:\xampp\htdocs\test_directory\ (note AuthUserFile is not a valid path as this was downloaded from an existing server and was going to be altered to this specific path)

Code: Select all
AuthUserFile /usr/www/users/ddrdata/.htpasswd
AuthGroupFile /dev/null
AuthName "DDR Tools"
AuthType Basic
require user admin


3. I placed this .htpasswd file into c:\xampp\htdocs\

Code: Select all
admin:fr2M8M3pPq5m2


4. I tried to access http://127.0.0.1/test_directory and was prompted to enter a username and password.
5. As I had not yet configured the .htaccess file correctly I canceled out of the password prompt and was greeted with an Object not found error.
6. Now accessing http://127.0.0.1/test_directory returns an Object not found error in firefox.
7. Deleted the new .htaccess and new .htpasswd files
8. Still returns Object not found error.
9. Tried http://127.0.0.1/another_directory and it loads the index.php file
10. Problem eventually tracked to be related to the presence of an .htaccess file in the directory ... if there is one (as in /test_directory) Object not found error is returned, if there isn't one (as in the /another_directory) index.php loads fine.
11. I am able to load http://127.0.0.1/test_directory/index.php fine, and I have been able to verify that the .htaccess file is still being parsed.
ddr
 
Posts: 4
Joined: 29. April 2009 05:18

Re: Perpetual Object not found error where htaccess file exists

Postby Sharley » 29. April 2009 06:43

I take it you corrected the path in the .htaccess file before using it?

You clear your browser cache often?

Look in the xampp\apache\logs\error.log file for clues.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Perpetual Object not found error where htaccess file exists

Postby ddr » 29. April 2009 06:56

Unfortunately I did not correct the path before using it which is where I believe the problem lies. I think that the wrong path at the time that I canceled out of the login prompt resulted in this current mess. I have cleared my browser cache several times and even used a couple of different browsers that had not been used of late just to make sure.

Checking the error log gives a good clue:

[Tue Apr 28 23:52:51 2009] [error] [client 127.0.0.1] script 'C:/xampp/htdocs/index.php' not found or unable to stat

It looks like even though I am trying to access http://127.0.0.1/test_directory /index.php it looks like apache is trying to find http://127.0.0.1/index.php. Just to be thorough I created an index.php in the root and sure enough my Object not found error is now replaced by this new index.php file.

I am unsure exactly what I need to change at this point but will try a few things. Any help would be greatly appreciated.

Thanks for the help Sharley, I am alot closer now!
ddr
 
Posts: 4
Joined: 29. April 2009 05:18

Re: Perpetual Object not found error where htaccess file exists

Postby Sharley » 29. April 2009 07:17

Your .htaccess file in C:\xampp\htdocs\test_directory should look similar to this:
AuthName "DDR Tools"
AuthType Basic
AuthUserFile "C:\xampp\htdocs\.htpasswd"
require valid-user


Your .htpasswd is placed in the htdocs folder but can be placed anywhere you wish as long as you change the path location in the .htaccess file.

If you wish to create a password for your user admin and create the .htpasswd file open a command console in C:\xampp\apache\bin folder (cd to this folder) and run htpasswd.exe which will give you a list of commands to use - using this method can create an encrypted password.

Try that and see how you go.

The error message in the log file checks out against the date and time of your last attempt?
It is trying to find a script index.php not a file index.php.
[Tue Apr 28 23:52:51 2009] [error] [client 127.0.0.1] script 'C:/xampp/htdocs/index.php' not found or unable to stat


If it was a file not found it may look similar this:
Code: Select all
[Tue Apr 28 23:52:51 2009] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/index.php referer:http://127.0.0.1/index.php
Last edited by Sharley on 29. April 2009 07:37, edited 2 times in total.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Perpetual Object not found error where htaccess file exists

Postby ddr » 29. April 2009 07:26

Yep the timestamp checks out. I checked the log, noted the last entry and then tried to load: http://127.0.0.1/test_directory ... then I cracked back open the log file and the new entry was there. As mentioned before when I created a file named index.php in the root (http://127.0.0.1/index.php) and then opened up http://127.0.0.1, the newly created index file was displayed.
Last edited by ddr on 29. April 2009 16:12, edited 1 time in total.
ddr
 
Posts: 4
Joined: 29. April 2009 05:18

Re: Perpetual Object not found error where htaccess file exists

Postby Sharley » 29. April 2009 07:31

See my edit above.

I am confused by the now temporary_directory mentioned as previous it was test_directory.
Which is it or was the temporary_directory just to test the file not found in error log file?
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Perpetual Object not found error where htaccess file exists

Postby ddr » 29. April 2009 16:12

Sorry, temporary_directory and test_directory are the same directory. I just forgot what I had called it previously. I will edit previous posts to clarify.

Thanks for the clarification on script vs. page. I am still unsure how to proceed but will be doing some research on it in the next few minutes and will report back should I find an answer.
ddr
 
Posts: 4
Joined: 29. April 2009 05:18


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 73 guests