Page 1 of 1

.htaccess error

PostPosted: 18. July 2008 02:41
by benza
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 ?

PostPosted: 18. July 2008 02:50
by Danodemano
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!

PostPosted: 18. July 2008 18:34
by benza
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)

Re: .htaccess error

PostPosted: 21. July 2008 22:55
by admindell
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