.htaccess error

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

.htaccess error

Postby benza » 18. July 2008 02:41

Hello,

I am stuck and need help here..

firstly I want to create a search engine friendly url, but not working. I've been trying different methods : forcetype, path_info, mod rewrite.. but all of them are not working on my localhost.

Then I have an idea to test .htaccess, simply I am create 2 files on folder f:/xampp/htdocs/mytest :
1. .htaccess
Code: Select all
    ErrorDocument 404 404.php


2. 404.php
Code: Select all
    <?
        echo "This is 404 error page!! .htaccess works !!";
    ?>


so, on folder mytest, there are only 2 files: .htaccess and 404.php.

when I try this on browser : http://localhost/mytest/index.php , I got an error :

Code: Select all
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
07/17/08 21:33:54
Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.1


Ok, now I know my .htaccess is not loaded (?) or passed..

Any idea ?
benza
 
Posts: 8
Joined: 18. July 2008 01:57

Postby Danodemano » 18. July 2008 02:50

My guess is that you need to set the AllowOverride config in the httpd.conf file to be All (make sure you restart Apache after changing this).
Code: Select all
AllowOverride All


You can also set the 404 page in the conf file (if you so desire) like this:
Code: Select all
ErrorDocument 404 /404.php


Finally, you should check to make sure that PHP is configured and that the file you wrote is correct by trying to access it directly with: http://localhost/mytest/404.php

Hope that helps!
Dan

Image
Danodemano
 
Posts: 31
Joined: 21. September 2007 00:16
Location: Dublin, OH

Postby benza » 18. July 2008 18:34

Thank you Dan,

Just a little change :
if I use :
ErrorDocument 404 404.php
then just showing:

404.php --> looks like the filename of 404 error.

I am expecting a text "Error !!" as a type on the php block

then if I use :
ErrorDocument 404 /404.php

it's return
Code: Select all
Not Found

The requested URL /forcetype2/pathinfo/345/234 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.1 Server at localhost Port 80


I am not sure the forcetype is run, a file pathinfo.php already on that folder, but not loaded/run, simply returning error 404 (file / object not found)
benza
 
Posts: 8
Joined: 18. July 2008 01:57

Re: .htaccess error

Postby admindell » 21. July 2008 22:55

benza wrote:Hello,

I am stuck and need help here..

firstly I want to create a search engine friendly url, but not working. I've been trying different methods : forcetype, path_info, mod rewrite.. but all of them are not working on my localhost.

Then I have an idea to test .htaccess, simply I am create 2 files on folder f:/xampp/htdocs/mytest :
1. .htaccess
Code: Select all
    ErrorDocument 404 404.php


2. 404.php
Code: Select all
    <?
        echo "This is 404 error page!! .htaccess works !!";
    ?>


so, on folder mytest, there are only 2 files: .htaccess and 404.php.

when I try this on browser : http://localhost/mytest/index.php , I got an error :

Code: Select all
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
07/17/08 21:33:54
Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.1


Ok, now I know my .htaccess is not loaded (?) or passed..

Any idea ?


in the htaccess file do this:
ErrorDocument 404 "this is a test

the " means to echo out a line of text, if it dont echo the text, then it dont work, if it does then that means its how you typed it, or spelled, or the dir,

and u have to add /404.php not just 404.php
I am creating a web admin panel for windoes xampp!

its called xDPanel.
the home page i have created can be found here. and please note that it is still under construction!
User avatar
admindell
 
Posts: 28
Joined: 28. May 2008 16:35


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 118 guests