Page 3 of 3

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:08 pm
by jaoudestudios
pytrin wrote:Does the .htaccess file in the script directory has the proper AllowOverride settings? (AllowOverride All)
http://httpd.apache.org/docs/2.0/custom-error.html
Ah hah, half way down the httpd.conf file....Nope it does not :( . Spot on pytrin

I recommend backing up your current httpd.conf file and then make changes - that way you can always go back to the original.

Currently you have this in your httpd.conf file...

Code: Select all

<Directory />
    Options SymLinksIfOwnerMatch
    AllowOverride None
</Directory>
But you need this...

Code: Select all

<Directory />
    Options SymLinksIfOwnerMatch
    AllowOverride All
</Directory>

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:14 pm
by Eran
Better not to change the global setting - create an .htaccess file in the directory you want this to perform, or create a directory container for that specific directory in the httpd.conf file:

Code: Select all

<Directory "/path/to/specific/directory" />
    AllowOverride All
</Directory>

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:17 pm
by Jordi
I just changed that, and.. you can see for yourself.. http://www.catalansoft.com/flightschool/f.pp still showing looping behaviour.

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:18 pm
by jaoudestudios
You will need to restart apache after any config changes.

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:19 pm
by jaoudestudios
Graceful might be enough.

Code: Select all

# graceful restart
apachectl graceful
or
# full restart
service httpd restart
EDIT: typo

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:19 pm
by Jordi
my .htaccess file now is:

Code: Select all

 
<Directory "/var/www/flightschool/" />
    AllowOverride All
</Directory>
ErrorDocument 404 http://jordiserres.homeip.net/flightschool/error.php
 

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:20 pm
by jaoudestudios
The <directory "/var..... goes in the httpd.conf file not in the .htaccess file.

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:24 pm
by Jordi
Sorry guys, but still crazy. I did restart the server after applying the changes, without success.
The current version of the .htaccess file follows, and the http.conf file is now unaltered.

Code: Select all

 
<Directory "/flightschool" />
    AllowOverride All
</Directory>
ErrorDocument 404 http://jordiserres.homeip.net/flightschool/error.php
 

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:35 pm
by jaoudestudios
Jordi wrote:

Code: Select all

 
<Directory "/flightschool" />
    AllowOverride All
</Directory>
ErrorDocument 404 http://jordiserres.homeip.net/flightschool/error.php
 
Your htaccess file should only contain 1 line...

Code: Select all

ErrorDocument 404 http://jordiserres.homeip.net/flightschool/error.php
Your httpd.conf file should contain...

Code: Select all

<Directory "/var/www/flightschool" />
    AllowOverride All
</Directory>

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:50 pm
by Jordi
No luck. I set the httpd.conf and .htaccess files as you suggested, restarted the server and.. everything is performing with no changes.

It's getting late for me, and I guess for you too. I'll try to fix it tomorrow and I'll let you know if I succeed.

Thank you so much for your help!

Re: Custom 404 error page

Posted: Wed Jan 14, 2009 1:58 pm
by jaoudestudios
No problem. Sorry we did not manage to fix it yet. :(

Re: Custom 404 error page

Posted: Thu Jan 15, 2009 4:16 pm
by jaoudestudios
OK OK OK. I think I have it!!?!?!!??!

I manage to get it working the other day when we were chatting, however, I was doing it all on my linux server. I just tried to do the same, i.e. create the .httaccess file on my windows machine and copy it over to my linux server and I got an internal server error. So i opened the file on the command line and some characters were corrupted. I re-wrote the file on the command line and all works fine.

Hope that helps!

Re: Custom 404 error page

Posted: Thu Jan 15, 2009 4:19 pm
by Jordi
Thanks, jaoudestudios.
I couldn't carry on with this issue today, so I'll give it a try tomorrow and I'll let you know.

Re: Custom 404 error page

Posted: Tue Jan 20, 2009 12:45 pm
by Jordi
Hi again!

After several tests, the issue is fixed now:
The problem was within these lines, formerly uncommented, that seem to apply an unwanted translation to each requested url within the site.

Code: Select all

 
#<Directory /var/www/>
#   RewriteEngine on
#   RewriteBase /
#   RewriteCond %{REQUEST_FILENAME} !-f
#   RewriteCond %{REQUEST_FILENAME} !-d
#   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
#</Directory>
 
At least, after commenting these lines, the apache server shows the expected behaviour when trying to access a non-existing page: it shows either the standard "404: page not found" error or redirects to the file in the .htaccess file.

Thank you guys!

Re: Custom 404 error page

Posted: Tue Jan 20, 2009 1:18 pm
by John Cartwright
As pytrin pointed out, this looks like an issue with your AllowOverride variable set to low.

I took a quick look at your httpd.conf and it appeared you are setting AllowOverride to the lowest permission ( AllowOverride None).