Creating Error 404 page
Helping lost visitors? Sometimes a link provided by you may end up as 404 page or viewer might have typed wrong URL that doesn’t lead correct page on your site. To help your visitors you can actually use .htaccess file (for Apache servers) to redirect all such links to a special page which will be more useful than plain “404 File Not found” error.
You can add this one line to .htaccess file (create this file if it doesn’t exist)
ErrorDocument 404 /web404.html
This will redirect all queries for files not found in that directory and sub directories to web404.html
On that page you can provide user with:
- Link to homepage
- Tell them to check the URL or Go Back
- Search functionality for your website will be very useful.
So yesterday I added a 404 page for my website: Check it out
I have also added similar functionality for my wordpress blog. For setting up 404 Error page on wordpress follow this well compiled article: Creating an Error 404 Page
Interesting read: Creating User Friendly 404 Pages
Enabling and disabling services during start up in GNU/Linux
In any Linux distribution, some services are enabled to start at boot up by default. For example, on my machine, I have pcmcia, cron daemon, postfix mail transport agent … just to name a few, which start during boot up. Usually, it is prudent to disable all services that are not needed as they are potential security risks and also they unnecessarily waste hardware resources.
The start-up scripts are stored in the ‘/etc/init.d/‘ directory. So if you want to say, enable apache webserver in different run levels, then you should have a script related to the apache webserver in the /etc/init.d/ directory. It is usually created at the time of installing the software.
This article describes how can we enable or disable different services during boot in different kind of distros like Redhat, Debian, Gentoo
Read More >>
Shell Tweaks
Setting Alias :
Aliases are abbreviations for commands or sets of commands. Example :
alias h= ‘history’ now Entering h in shell will execute the history command.
alias ls =’ls -l’
you can set these in .bashrc so that every time you login these aliases will be set
to delete the previous alias definitions issue the commands:
unalias h
Defining Functions :
Functions can also be used to ensure that graphical commands always open in the background:
this can be defined in .bashrc
function gimp
{
command gimp “$@” &
}
Now every time you do gimp it will load it in backgroun automatically.
Searching history :
history n
this will print history of last n commands
for searching it CTRL + R can be user
Directory Name Typos
When changing directory small typos can be ignored by Bash
Enable this in .bashrc
shopt -s cdspell
Bash will cope with each component of the typed path having one missing character, one extra character, or a pair of characters transposed:
$ cd /vr/lgo/apaache
/var/log/apache
Directory Bookmarks
Some directories are changed to more frequently than others.
Can avoid typing their full paths if their parents are in $CDPATHwrite this in .bashrc
CDPATH=’.:..:../..:dir1:~:~/projects:/var/www/virtual_hosts’
now if dir2 is in projects directory then you can do
cd dir2
~/projects/dir2
It will go to dir2 due to CDPATH
env Lists all environment variable
Commands to be executed on opening shell should be written in .bashrc
Commands to be executed on logout should be written in .bash_logout
For changing the way prompt looks you can set variable PS1
Updated :
Enhancing the System Prompt change PS1 variable
More About Shell
CTRL + L will clear the screen
CTRL + T will interchange last two letter of a command
Add to del.icio.us Network
Google Reader Shared Items
Twitter Feed
Flickr Photos