Creating custom 404 page

Everyone at some point has been browsing trough google or their favorite search engine and clicked on a link just to go into a white page with the words ???404 Error??? up on top. After this the only thing you have is to hit the ???Back??? button on your browser. As a user, this means that you go backand try another link. As a developer do, it means that you lost a potential clients, and that you have a glitch in ξyour application that you are not aware of.

You can set upt a custom 404 page using your apache .htaccess file. Here is how to do this:

  1. Access your server via FTP
  2. Make sure that you can see hidden files
  3. Locate for .htaccess
  4. If .htaccess does not exist go ahead and create it
  5. Open the file
  6. Type: ErrorDocument 404 /404.php
  7. Save the file
  8. Now you can go and edit this file so that you can have a custom error page.

That is all that you have to do in order to set up your server to have a custom 404 page. Use your imagination on this one, for examle you can have a search function or related pages to what the user was looking for. You can also have this page email you so that you become aware of the situation.

Hope this helps, any questions or concerns can be submitted below.

Transfer a Large Database using MySQL Dump and a SHH Client

Have you needed to transfer a large database? One of an eCommerce Cart or of a big blog? phpMyAdmin only allow’s imports of databases of 2 mbs, if you fix the php.ini file you can get maybe 10 or 12 max on most servers. In order to move this you will need to do it through shell access. Here is instructions on how to do this:

  1. Contact your service provider and tell them to allow shell access in your account.
  2. Download a SHH client like puTTY
  3. Open the application, enter your domain and the port. (I have usually encounter them to be 22 or 2222)
  4. Enter your username and password. These are usually the same as your FTP credentials.
  5. To export or dump the MySQL database you will be using a tool calles MySQL Dump, to do this you will type:
    1. mysqldump -u [username] -p[password] [dbname] | gzip > [location/name].sql.gzip
    2. the items in [ ] need to replaced and the brackets removed. Also please note there is no space between -p and your password
    3. This will create what is called a dump file of your database which will be gzipped for easier development.
  6. Now you need to get the file that was created and upload it to your new site via an SFTP or FTP client.
  7. After this enable shell access on your new server or location and access it
  8. First we need to decompress the .gzip file, to do this type:
  9. gzip -d [location/file].sql.gzip
  10. After this is completed the gzip file will dissapear and you will only have the sql file needed.
  11. Now all you need to do is import the file into your database, to do this type:
    1. mysql -u[username] -p[password] [dbname] < [location/file].sql
  12. Your import and transfer of your MySQL database is now complete.


Do you need any work performed on your database or on your web application? You can contact me at (619) 800-2678 or using the Quote Request form.

Shell or SSH Commands and Beginner 101 Course

Using Shell or SSH connection to interact with your Linux server could be the most powerful tool you can have. This is because when you connect via this interface you are actually working from inside your server and this gives you more power and control over whatever you are doing.

To start off you need to contact your server provider and tell them that you want shell access enabled in your account. Some companies like goDaddy use telephone to confirm, others ask you to fax or email a copy of your drivers license. Most of them will have one way or another to do this.

After this you will need to get a telnet application like Putty which is Freeware by the way. Once you download this open it and enter your web address in the input box then click connect. It will ask you for your username and password, they are usually the same as your main hosting account credentials. After this you are good and it, very simple correct.

This interface looks like your regular MS-Dos Command Prompt, and don’t be scared it is very simple to use. Here is a list of commands to get you startes

  • pwd
    • Show you the directory you are in
  • ls
    • Shows you the files that are in your current directory
  • ls -al
    • Shows you all the files in the current directory with file permissions, sizeξmodificationξdate, owner and group names and name
  • cd /directoryname
    • Changes current folder to a new destination
  • df
    • Gives you a report of free space
  • rm {file}
    • Removes a File
  • rmdir /directoryname
    • Removes an empty Directory
  • rm *
    • Removes all non-protected files in your current directory
  • rm -r
    • Removes all non-protected files in your current directory and sub folders using recursion. Protected files will ask you for permission
  • ftp {ftp address}
    • Connect to an FTP server
  • get {filename}
    • Dowload a file from the ftp connection
  • put {filename}
    • Upload a file using the ftp connection
  • cp {filename} {newdir}
    • Copy a file into a new directory
  • cp * {newdir}
    • Copy all files from current directory into a new directory
  • cp *.txt {newdir}
    • Copy al .txt files into a new directory
  • vi {filename}
    • Opens the basic text editor and opens the file
  • mv {filename} {newdirectory}
    • Moves the file(s) to a new directory
  • mkdir {newdirectory}
    • Creates a new folder or directory
  • mkdir -p {directory1}/{directory2}/{directory3}
    • Creates multiple nested folders in one shot
  • who
    • Tells you who is connected to your server
  • cat /proc/meminfo
    • Shows your system’s available memory
  • history
    • This command will give you the last 10 commands you entered

This is just a list to get you started. Shell access is the only way that you will have complete control over what you and your applications are doing. You will be able to do much more from there so start geting used to it. There will be a series of tutorials that I will create about using the Shell Command Line so come back to check on us, my next Shell entry will be a tutorial in how to transfer files the right way, and without even using yourξbandwidth.

Please leave any comments or questions below.

Thank You,

Gilberto Cortez