Using .htaccess To Add Your 404 Error Page, For Apache Web Servers Only |
Using .htaccess To Add Your 404 Error Page, For Apache Web Servers Only |
May 8 2007, 09:54 AM
Post
#1
|
|
WSF Commander Group: Admin Posts: 4,662 Joined: 26-August 05 Member No.: 10 |
SYMPTOMS
Your control panel does not allow you to change the 404 Error to use 404.php CAUSE They may use a fixed 404.shtml or the Administrator may have disabled the feature. SOLUTION Create a file called .htaccess in your web documents root directory (your installation includes htaccess.txt which can be renamed). Make sure it includes:- CODE ErrorDocument 404 /404.php For example your .htaccess might look like this:- CODE ########################## #Apache Only system file ########################## #Sets up 404 ########################## ErrorDocument 404 /404.php ########################## # Remove the # to disable magic quotes # (This could cause server errors if you # do not have permission) ########################## #php_flag magic_quotes_gpc off You can also check these settings SYMPTOMS Although you have setup the Custom Errors for your web server to call 404.php none of the virtual pages, rotator URLs or link tracker URLs are working correctly and may send you to the homepage. CAUSE Some server configurations adding superfluous characters to the query string. SOLUTION Switch on the 404 Filter BCP -->Configuration --> General Configuration --> 404 Filter --> Yes Also check Also check your .htaccess has not been overwritten or altered in such a way as to invalidate the ErrorDocument entry. |
|
|
May 13 2007, 01:54 PM
Post
#2
|
|
WSF Professional Group: PM Unlimited Posts: 927 Joined: 4-May 07 From: Phoenix, AZ Member No.: 1,089 Exchanges: |
Martyn,
This will not work for me. I have my .htaccess set up exactly like this but it does not affect either the magic quotes or the 404 Error page function. Can this be corrected on the server? I have a virtual dedicated server with root access. If you can tell me where this information is located on the server, maybe I can delete it there. -------------------- |
|
|
May 14 2007, 12:49 PM
Post
#3
|
|
WSF Admiral Group: Admin Posts: 10,514 Joined: 25-June 05 Member No.: 5 |
Hi sunwest,
If the .htaccess method doesn't work put that code into your section of the httpd.conf and restart the webserver it should work -Adam |
|
|
Nov 21 2009, 12:40 PM
Post
#4
|
|
WSF Newbie Group: Members Posts: 4 Joined: 21-November 09 Member No.: 2,569 |
Newbie question sorry ...
I'm trying this to eliminate it as the cause of other problems but stuck already ... In my direcrtory, the htaccess file is named htaccess.txt If I change it to .htaccess I get server errors on every page of the site ttat I've checked. Could someone confirm for me what it is meant to be named? Thanks |
|
|
Nov 21 2009, 01:15 PM
Post
#5
|
|
WSF Commander Group: Admin Posts: 4,662 Joined: 26-August 05 Member No.: 10 |
Yes it does need to be renamed BUT the entries need to be modified to suit your hosting. If you are getting 500 Internal Server errors it is probably because of this line:-
CODE php_flag magic_quotes_gpc off So remove it and then see if it works. For an explanation use the google search box and you will find why this may be required. If you still get the error then your host has probably disabled the use of .htaccess. As this is rare and likely means the host operates restrictive web access you will need to ask them for assistance and if they are not helpful or do not understand consider another host (sorry, I know that sounds dramatic but there are a lot of small hosters out there who operate like unskilled garage mechanics with a claimed propensity of knowledge in their chosen field). |
|
|
Lo-Fi Version | Time is now: 18th November 2024 - 07:23 PM |