cancel
Showing results for 
Search instead for 
Did you mean: 

Custom 404 Page

GandD
Member

Does anyone know if it's possible to have a custom 404 page?

 

Any ideas would be helpful!

 

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions

dave
Guru

Don't give up yet, it's not that difficult 🙂

This is how to do it:

 

Download putty.exe from the download location and run it.

Enter the host name as provided by the website centre, this will be something like shell2c31.carrierzone.com.

Click Open to connect and click yes when you get the alert about the key.

You should now have a login prompt saying "login as:"

Type your domain name here and press <enter>

Then type your SSH password when prompted and press <enter>

You should now be in and have the command prompt starting shell1c30:/$

 

Now for the fun part 🙂

 

Type vi /public/.htaccess <enter> to open the VI text editor with the .htaccess file.

Press i to begin text input mode

Use the down cursor to get to the end of the text and then on a new line enter your line ErrorDocument 404 http://www.yoursite.com/custom_page.html

Press the escape key to exit text input mode

Type :wq <enter> to save and quit VI

Type cat /public/.htaccess to list the contents of your .htaccess file. Check that your line has been appended to the end successfully

Type exit <enter> to end the sesssion

 

That should be all there is to it really. Good luck 🙂

 

Message Edited by dave on 05-02-2009 09:15 AM
Message Edited by dave on 05-02-2009 09:28 AM

View solution in original post

30 REPLIES 30

kev1n
Super User

Hi GandD,

 

Please click on this link and see if this is the information you require. Please let us know if this helps? Regards, Kevin.

Kind Regards,

Kevin,

BT Business Support Moderator

Hochiki
Member

Hi Kevin, found your posting on the custom 404 page, and followed your suggested link.  I've gone through the article but it doesn't really help when you don't know what type of server BT is using, i.e. Apache or not. 

 

Also, I can't find a way of viewing the higher set of directories for my web space (in other words the other directories above the "docs" directory) as I'm sure this is where I would find the .htaccess file.

 

Can you provide a step-by-step guide to locating, editing and saving the .htaccess file for your BT Business Web users?

 

I am editing my site using FrontPage - so how do I get to those high level directories - I can't see a .htaccess file here.  When on BTWebWorld I used to be able to use "My Network Places" in Windows to see the "docs", "logs", "rafiles" and "secure" directories.

 

Paul.

dave
Guru

It is entirely possible to have a custom 404 page. I have successfully done it myself.

 

Firstly, the server is running Apache.

 

You say you are running Frontpage - if you have Frontpage extensions enabled then this will be why you cannot see anything about the public folder. Enabling the Frontpage extensions makes the public folder the top level folder that you have access to.

 

However, this should not be a problem. The public folder is exactly where you need to place your .htaccess file. If one does not already exist, you can simply create your own.

 

Open Notepad and enter the following line substituting the address for the address of your 404 page:

 

ErrorDocument 404 http://www.yoursite.com/custom_page.html

 

Save the file as .htaccess (make sure you don't get .htaccess.txt) and upload both it and the 404 page to your public folder.

Hochiki
Member

Hi Dave and thanks for the follow-up.  But I still can't seem to achieve this.  I have the file .htaccess ready to go with a suitable "Not Found" page.  The .htaccess file is invisible in the directory tree in FrontPage, possibly as it isn't either a folder or a web page.  But checking the contents of the local web folder through Windows Explorer confirms that it is there.  A standard "one-button" publish through FrontPage doesn't seem to send the .htaccess file across, but as it's invisible, so even if I open up the remote site with FrontPage - I can't see the file there.  But testing by typing "carrots.htm" for example - returns the standard IE 404 page, not my customised one.

 

I've also tried dragging the .htaccess file from Windows Explorer across into the remote site in the FP window (and also copy and paste) with the resulting error message:

 

"Server error: '.htaccess' does not refer to a page or folder in this web.  It may be a page or folder in a subweb, or it could be a badly formed URL.'

 

I've tried to be sneaky and change the local file to "htaccess.txt" - which gets uploaded fine - then I tried renaming the file on the remote web to ".htaccess" but it refuses to change beyond "htaccess" - I can't get that initial "."!

 

I suspect FP doesn't like the fact the file doesn't have a recognisable extension.  I might be able to upload using an FTP client app - but this will break my FP extensions.  Any other ideas?

 

Paul.

dave
Guru

I seem to recall that if the custom 404 page is under a certain size then IE will ignore it and display it's own internal 404 page.

 

Have you tried to bring up the 404 page in another browser like Firefox or Chrome, etc?

Hochiki
Member
Hi Dave, regardless of the size at the moment - this isn't going to work unless I can get .htaccess up on the site.  Any other ideas for getting this file across to the live site, via FP or another method?

dave
Guru

To be honest, I am not sure how possible this is going to be.

 

This page here advises:

 

"If you have FPSE installed on your server and wish to upload an .htaccess file to create a 301 permanent redirect or specify a custom error page, you need to exercise caution. There is already an .htaccess file in place on the server if you are using FPSE."

 

"Any code you add to your .htaccess file MUST be added AFTER the existing code."

 

And now for the problem part... 🙂

 

"You will NOT be able to see the .htaccess file from within your Remote Listing in FrontPage. If you open the site in your ftp program you will see the .htaccess file"

 

The problem with this is that on BT's system you are not able to use FTP and Frontpage Extensions at the same time. You have to choose between one or the other.

 

Of course, you could disable Frontpage extensions and create the file using FTP, however if you were to then re-enable Frontpage Extensions it would most likely overwrite your custom .htaccess file with the one that Frontpage needs to work.

 

If you want to set this up, you are probably going to have to ditch the Frontpage Extensions for good.

 

Actually, there is one alternative way that you might be able to make this work... if you have the £15 Advanced Hosting package, you could enable the SSH connection and this would allow you access to the .htaccess file even with Frontpage Extensions enabled. Of course, you would need to be fairly proficient in unix command line to be able to make the necessary edit to the file, but it should work.

Hochiki
Member

Thanks Dave.  Getting rid of the FP extensions and functionality is a no-go unfortunately.

 

I looked into enabling the SSH as you suggested, but the PUTTY app BT recommended looked far too "techy" for this mere web designer, so I didn't pursue this.  It's a shame, but I'll have just have to rely on the standard 404 page.

 

Looks like the curse of FP strikes again...

dave
Guru

Don't give up yet, it's not that difficult 🙂

This is how to do it:

 

Download putty.exe from the download location and run it.

Enter the host name as provided by the website centre, this will be something like shell2c31.carrierzone.com.

Click Open to connect and click yes when you get the alert about the key.

You should now have a login prompt saying "login as:"

Type your domain name here and press <enter>

Then type your SSH password when prompted and press <enter>

You should now be in and have the command prompt starting shell1c30:/$

 

Now for the fun part 🙂

 

Type vi /public/.htaccess <enter> to open the VI text editor with the .htaccess file.

Press i to begin text input mode

Use the down cursor to get to the end of the text and then on a new line enter your line ErrorDocument 404 http://www.yoursite.com/custom_page.html

Press the escape key to exit text input mode

Type :wq <enter> to save and quit VI

Type cat /public/.htaccess to list the contents of your .htaccess file. Check that your line has been appended to the end successfully

Type exit <enter> to end the sesssion

 

That should be all there is to it really. Good luck 🙂

 

Message Edited by dave on 05-02-2009 09:15 AM
Message Edited by dave on 05-02-2009 09:28 AM