Saturday, October 5, 2013

Making A Custom Page Not Found

You worked hard to get traffic to your website so the last thing you want is to lose visitors because a webpage they requested cannot be found, either because it has been moved, deleted, renamed, or the url was mistyped.

Such incidents happen quite often and when they do visitors are greeted with the standard "page cannot be found" message browsers display when the website doesn't have a custom error page to deal with such situations.

Custom error pages will help you retain those visitors by directing them to other parts of your website through links on the error page. And you know what? Making a custom error page is quite easy to do as you are about to see. The only requirement is that your site needs to be located on a paid web hosts since most free hosts don't allow custom error pages.

The error page requires two files, one is the error page which is a regular HTML webpage that contains any information and links you want to put into it. You can name it anything you like such as oops.html

The other file is a .htaccess file. This file tells the web server to show the error page you made when folks encounter a webpage that doesn't exist.The .htaccess file is made in any standard word processor such as Notepad. So open a blank file and add the following code:

ErrorDocument 404 http://www.mysite.com/oops.html

It should be on one line, replace http://www.mysite.com/oops.html with the entire url leading to your error page. Save the file by naming it .htaccess  including the dot preceding it. 

Upload both files to the public_html directory (where index.html is located). When your .htaccess file was created the word processor most likely attached an extention so that it looks like this:

.htaccess.txt

The .txt extension needs to be removed by renaming the file within the ftp program or the file manager in your cpanel . That's it now test you error page by entering a non existent page in your site url within the browser's address bar. If you get your customized error page mission has been accomplished.

NOTE  Some web hosts include the .htaccess file in your account, if you see it simply open and edit it so that ErrorDocument 404 points to your custom error page.

Friday, May 24, 2013

Hide Your Email Address From Spammers With Contact Forms

Every website should give visitors a way of contacting the person who runs it (that's you, right?). But if you place your email address anywhere on your site sooner or later it will fall into the hands of spammers and you will end up with a lot of unwanted email, and I mean a lot.

A simple solution is to use a contact form instead. Contact forms give visitors a way to contact you without revealing your email address. Though it won't stop unwanted email completely, it will prevent your email address from ending up on lists that are traded or sold to marketers who send junk email in bulk.

An actual contact form is easy to make with HTML form tags however to get it to work requires a script which is beyond the capabilities of HTML code. But not to worry, there are online form services that will make and process forms for you. You simply choose the elements you want to include on your form such as a message text box, and the code is automatically generated for you to copy and paste into your webpage. When someone uses the form to contact you, their message is sent to the email address you specified when you signed up for the service.

A free service I can personally recommend because I use it for my contact forms is www.emailmeform.com Of course there are others, both free and paid, do a search to find the one that's best for you and give your inbox a break from spam. If you would like to learn how to construct forms see the tutorial Tags For Making HTML Forms.

Thursday, April 11, 2013

Free HTML Editor Software

When updating my website  I wanted to write code so that it would validate as being properly written in version HTML 5,  at least for the main webpage. In order to do that I needed to include this tag between the head tags of my HTML files:

<meta charset="UTF-8">

I wrote my HTML code in Notepad and by default Notepad encodes files, including HTML files, in ANSI instead of UTF-8. Notepad does have the option to save in UTF-8 encoding, but not the right kind. Don't ask me what all this stuff means because I haven't got a clue, all I know is that I needed to find a word processor which will save HTML files in the kind of UTF-8 encoding  that would make my webpage pass the test.

In my search I came across Notepad 2. It's completely free and is a simple but pretty handy  little HTML editor. By little I mean it's only around 300kb and can be kept and run off  a usb drive without any  installation needed, I just downloaded the zip file from www.flos-freeware.ch/notepad2.html, unzipped it and launched the program by clicking on its icon ( I downloaded the 4.2.25 Program Files (x86) zipped version).

Some of its features:
  • auto inserts closing tags (saves you some finger work)
  • unlimited undo and redo (something that comes in handy for me)
  • syntax highlighting to help you catch coding errors

Sorry Apple fans, Notepad 2 is only for Windows but I'm sure there's something similar for you Macheads too.

Oh yeah, and I forgot to mention, it encodes in the kind of UTF-8 I needed, which was why I was  searching for a new HTML editor in the first place. It's now become my main editor for writing HTML, but I still think plain old Notepad is pretty good, as long as you don't use <meta charset="UTF-8">

Screen Shots

 



Tuesday, April 2, 2013

How To Tell Google WebSite Has New Domain Without 301 Redirect

When I decided to get a domain name for  my website HTML Made Easy I faced the problem of how I was going to get Google to replace the old url with the new domain. Usually it's done with a 301 redirect but I didn't have that option because my site was located on the web space that came with my internet account. My site was already doing well in Google searches so I needed to find a way for Google to list the new domain instead of the old web address.

I did a bit of googling (well actually a lot of googling) and I found the solution - use canonical rel tags on the pages of the old site. The purpose of this tag is to give webmasters the option of telling Google which page they would rather see listed if they have 2 identical webpages. Take for  example a website selling shoes, one page may list the shoes by price while the other page lists them by brand. If Google crawls the webpage with shoes listed by price and sees the canonical tag pointing to the webpage listing shoes by brand, Google will know that the webmaster prefers the brand page be listed in search results and not the price page.

This is just what I needed and Google approved, within a couple weeks the new domain began replacing the old url in Google search results.

The canonical rel tag goes between the head tags of the webpages that are showing in search results but that you want replaced. This is what the canonical tag looks like:

<link rel="canonical" href="http://www.newdomain.com">

That code would be placed in index page, replace www.newdomain.com with the url of your new domain. All the other pages you want replaced in search results must contain the exact url  of the matching  webpages on the new domain:

 <link rel="canonical" href="http://www.newdomain.com/gallery.html"> 

It's important to note that the content of the new webpages must be identical to the webpages they are replacing. If they are not Google may think that the pages on the new domain are not a good match for the keywords under which the old pages are showing. You will find more information about the canonical tag on Google's support page.



Saturday, March 23, 2013

Pointing Domain With Ip Address

Using a web host's dns will disable some of the free stuff  Name Cheap includes with its domain registration such as email forwarding. A way around this is to point the domain to your site using an ip address instead of the webhost's dns. There is a  drawback to using this method because sometimes the ip address changes and needs to be updated or the domain won't work.

But this is my preferred method of pointing a domain because I like the email forwarding and other features that come with Name Cheap, and it only take a couple of minutes to update the ip should it change. (I only had to update it once so far).

Here is how to set up a domain at Name Cheap using an ip address with a website hosted for free at  50webs.com.

2. In your 50webs control panel click  Site Management.  You should see a number referred to as "Default route", this is the ip address:




3. Copy the ip address and go to  your Name Cheap account, click “Your Domains/Products” in the upper right sidebar on your account page:



3. Next click on your web address:


4.Click All Host Records in the left sidebar:


5. Enter the ip address you got from your 50webs account into the @ and www  text boxes, and select A (Address) from the drop  down menu:


The @ and www text boxes are to ensure that the domain works both with or without the www in the domain's url. Click the Save button near the bottom of the page and you are done. It will take anywhere from a few minutes to several hours for your domain to begin working.

To set up a domain with dns see the post Pointing Domain To Free Web Host.



Pointing Domain To Free Web Host

One of the cool things about the internet is that there's a lot of stuff you can get for free, including web hosting for your website.Here is how to set up a domain registered at Name Cheap to work with the free web host 50webs.com.

Go to 50webs.com and sign up for a free web hosting account. The sign up page will ask you to fill in your details, where it says Add a Domain Name to host select Use my existing domain and enter your domain url into the text box:



Once you have your web hosting account  login to your Name Cheap account to configure the dns settings. Oh relax it's going to be easy.

1. In your Name Cheap account click Your Domains/Products  in the upper right sidebar:


2. Next click on your web address:


3. Click Transfer DNS to webhost in the left side bar:



Please note that "transfer DNS to webhost" is NOT the same as transferring a domain, your domain will still be registered at Name Cheap.

4.Enter dns1.50webs.com and dns2.50webs.com into the text boxes and be sure "Specify custom DNS servers" is selected:


 Click the Save button and you are done! Told you it was easy. It will take anywhere from a few minutes to 48 hours  for your domain to begin working with your site. So get to it, start uploading your site files while you wait and be sure the file name of the home webpage of your site is index.html otherwise your domain won't work.

Note
When using the dns of a web host some of the services  Name Cheap provides such as email forwarding and url forwarding will not be available. If  you would like to continue to have all the services of Name Cheap you can point your domain to your website using an ip address instead of  dns. Read how in  the post "Pointing Domain With Ip Address.