Thursday, June 11, 2009

htaccess Tricks Every Webmaster Should Know

If you’re new to htaccess, here’s a quick introduction. Otherwise, May be this tips are already you know but here are 5 sets of htaccess directives every webmaster should know:

Redirect Visitors While You Update Your Site

Update and test your site while visitors are redirected to the page of your choice:

order deny,allow
deny from all
allow from 123.123.123.123

ErrorDocument 403 /page.html


allow from all

Replace 123.123.123.123 with your IP address. Also replace page.html with the name of the page you want visitors to see.

Display a Custom 404 Error Page

Your server displays a “404 File Not Found” error page whenever a visitor tries to access a page on your site that doesn’t exist.

You can replace the server’s default error page with one of your own that explains the error in plain language and links visitors to your home page. Here’s how to use your own page:

ErrorDocument 404 /404.html

Replace 404.html with the name of the page you want visitors to see.

Handle Moved or Renamed Pages

You’ve moved or renamed a page on your site and you want visitors automatically sent to the new page when they try to access the old one. Use a 301 redirect:

Redirect 301 /old.html http://yoursite.com/new.html

Using a 301 redirect also ensures the page doesn’t lose its search engine ranking.

Prevent Directory Browsing

When there’s no index page in a directory, visitors can look and see what’s inside. Some servers are configured to prevent directory browsing like this. If yours isn’t, here’s how to set it up:

Options All -Indexes

Create User Friendly URLs

Which of the two URLs below looks friendlier?

http://yoursite.com/about
http://yoursite.com/pages/about.html

When it comes to URLs, as long as the meaning is clear, shorter is always better.

With htaccess and an Apache module called mod_rewrite, you can set up URLs however you want. Your server can show the contents of “/pages/about.html” whenever anyone visits “http://yoursite.com/about”. Here are a few examples:

RewriteEngine on
RewriteRule ^about/$ /pages/about.html [L]
RewriteRule ^features/$ /features.php [L]
RewriteRule ^buy/$ /buy.html [L]
RewriteRule ^contact/$ /pages/contact.htm [L]

There’s a lot more to mod_rewrite and htaccess. Check out the links below for more details and tricks.

Additional Resources

Apache htaccess Ultimate Guide
Comprehensive guide to .htaccess
mod_rewrite, a beginner’s guide (with examples)
Stupid htaccess Tricks

Wednesday, June 10, 2009

Multi-Downloading from Rapidshare.com

It is tested and working, i've just done a 45 file download with it. So i HOPE this will be of help to someone, it was discovered whilst trying to solve a problem i had with I.D.M. and Deer Hunter 2005.... They just didn't like each other on the same machine.

Not only that ...RapGet is very very easy to use.. even for me !! Even the kids will be able to use this one to download their games.

Download word file with detailed information:Multi-Downloading from Rapidshare

feel free to leave comments !

Find who is Invisible on Yahoo messenger

Sometimes some of your friends who appear offline in yahoo messenger may not be actually offline,they may in the 'Invisible' mode.This maybe if they are trying to ignore you or are too busy to talk to anyone.

There is this small trick that you can use to find out what the truth is.

Firstly open your yahoo messenger main window and double click on the name of the person whom you want to check.The chat window will open obviously.

Click IMVironment button, select See all IMVironments, select Yahoo! Tools or Interactive Fun, and click on Doodle.
After loading the Doodle imvironment there can be two possibilities

1.If the user is offline Doodle are will show this "waiting for your friend to load Doodle" continuously .

2. If the user is online (but in invisible mode), after few seconds (it can take up to one minute, depending on your connection speed), you should get a blank page So you know that the user is online.

Saturday, June 6, 2009

Download Youtube video in .mp4 format

  • Download Youtube video in mp4 format without using any software or any website using a simple javascript.
  • This script let you download Youtube video directly from the website without any delay.
  • Below is the code to download a video from the you tube,copy-paste this code into the address bar when your desired video starts buffering.Isn't it amazing script??? I have attached a screenshot of the video also.
  • copy this script into address bar:

javascript:if(document.location.href.match(/http:\/\/[a-zA-Z\.]*youtube\.com\/watch/)){document.location.href='http://www.youtube.com/get_video?fmt='+(isHDAvailable?'22':'18')+'&video_id='+swfArgs['video_id']+'&t='+swfArgs['t']}

KidZui- Browser for Kids on the Internet

KidZui is quite a novel spin on an old concept. It is basically a browser that advises rather than restricts your kid's movements. Full-scale and much more mature products such as Net Nanny, Safe Eyes and the like give complete control over what is run in the PC, subject to parent-imposed restrictions. However, KidZui isn't aiming at that kind of child security but rather plays a supportive, guiding role as a kid-friendly browser.


No it isn't yet another browser thankfully (new browsers always have compatibility as well as security issues), but rather a plugin/extension for respective browsers like Firefox and/or Internet Explorer depending on what you choose. Surprisingly while still acting like a plugin, KidZui takes over not only the browser and its look but also restricts access to the entire computer
. This is typically to avoid tech savvy children from switching between browsers or closing KidZui
First off you need to download KidZui from www.kidzui.com. Depending on the browser you use to visit it, you are given an option to download it. I chose firefox KidZui extension.
After installation you need to create a Zui account for your child. This is a fun process where you can choose the gender, skin tone, hair, clothing, etc. Your child will need to enter a unique screen name and password. My Zui called 'Zulk' looks like an illegitimate offspring of The Hulk!

Final approval of a new Zui occurs only when the parent responds to the activation e-mail.

Enable or Disable Task Manager in Windows

Task manager comes really handy when your windows hangs! This is your last option to kill the useless processes. But some times some viruses have a capability to disable task manager from windows. In this situation you are not able to end the hanged applications & heavy processes.

To Enable Task Manager

Start → Run → gpedit.msc (type) → Administrative Templates → System (double click) → Ctrl+Alt+Del options → Remove Task Manager → properties → disable (select) → Ok

To Disable Task Manager

Start → Run → gpedit.msc (type) → Administrative Templates → System (double click) → Ctrl+Alt+Del options → Remove Task Manager → properties → Enable (select) → Ok

VN:F [1.3.1_645]

Use Pen drive as a ram in windows vista think Vista

Are you tired of Windows Vista’s slow performance?

Well now there is remedy of your performance problems if you are running Windows Vista. Vista provides a great feature called Ready boost. With this feature, you can utilize your pen drive or a memory card as RAM. Thus you can increase the RAM allowing the operating system more space of cache and fast access memory.

With this feature, it increases the additional memory in your computer system to improve the performance of your personal computer. Some times many users are worried that they have a limited expansion slot in their mother board (especially if you have a laptop) and they cannot increase memory. Also, replacing the existing RAM could be more costly option. For laptop users it is not so easy also.

To use your pen drive as additional RAM, follow the below steps:

USB pen drives and SD memory cards can serve as additional cache to fetch data more quickly from HDD. Windows vista has this great capability of intelligent memory management known as “Windows Super fetch”.

Firstly windows will check the capability of the device (flash drive). If it is capable then they the system will show this additional option.

Steps to enable Ready boost option:-
  • When you plug the USB device in the USB port, it will show the message “speed up my system” using windows ready boost. Shown in fig-1.

  • If you select the ready boost option which is shown in the above fig-1. Then, in the Removable disk properties it will show ready boost option as shown in fig2.


  • Choose the option “use this device” and increase the limit of “space to serve for your system speed” option. The reservation of memory is depending on the capacity of pen drive (flash drive) as shown in fig 3.

  • Suppose you have to increase the memory according to your need then another file, the size of which is more than the reserved space will not be copied on that drive. Ready boost option reserves the space according to your choice. Shown in fig 4.


  • If you do not select the option initially when the the pen drive was plugged-in the usb port then the system shows the default option which is shown in fig1. If you want to ready boost now, then you have to select pen drive , right click on the icon and then follow the above step to enable ready boost option.

Friday, June 5, 2009

Amazing Ubuntu Tips part (5)

The command-line

41. Try it, it’s really not that bad
The command-line really is your friend. After opening Terminal from the Applications>Accessories menu (or Konsole in KDE), you can accomplish many common tasks much more effectively than from any desktop GUI. To copy folder, for example, type ‘cp -rf source destination’, rename a file with ‘mv’ and edit a text file using a command called ‘nano’.

42. Easy command shortcuts
You can press the tab key while using the command-line to automatically complete command names as well as system paths. You can also cursor up through your command history, and use ‘Ctrl + r’ to search for a command starting with the characters you begin to type.

43. Replace heavy GUI applications with command-line equivalents
There are command-line versions of most desktop applications. You could install and use ‘pine’ for your email and news, for instance. Or try ‘lynx’ for web browsing and ‘wget’ or ‘ncftp’ for downloading files. ‘mc’, short for Midnight Commander, is a feature-full file manager, and all of these tools will run on hardly any memory with hardly any CPU requirements.

44. Create an ISO images from a CD or a DVD
You can create an ISO image from optical media, and most attached devices, by using a single command on the terminal. Type ‘dd if=/dev/cdrom of=disk.iso bs=1024′ to make a raw copy of the data and drop it into the disk.iso file. You may need to unmount the drive first, by typing ’sudo umount /dev/cdrom’.

45. Read an ISO disc image without burning it
If you’ve downloaded an ISO disc image, and you want to access the files on it without wasting an optical disk, you can create a virtual drive from the image with a single command. Open the terminal from the Accessories menu. Type ’sudo mkdir /mnt/image’, followed by ’sudo mount -o loop disk.iso /mnt/image’. You can now browse the disc by pointing a file browser at the ‘/mnt/image’ folder.

46. Use the ’screen’ command
After you’ve got used to the command-line, one of the best commands to learn is called ’screen’. It’s the command equivalent to virtual desktops, and it lets you run several sessions at once, as well as suspend and resume a session. Type ’screen’ to start, then press ‘Ctrl a’ followed by ‘c’ to create a new session. ‘Ctrl a’ and ‘n’ or ‘p’ will switch through the active sessions. ‘Ctrl a’ and ‘d’ will detach from the session, while typing ’screen -r’ will resume one.

47. Access your Ubuntu machine from anywhere
The best thing about the command-line is that you can use it to access your machine securely from anywhere on the internet. The key to this is something called ‘SSH’ - the secure shell. Install ‘openssh-server’ through Synaptic and use a tool called ‘putty’ on a Windows machine, or ’ssh’ on Linux, to access the command-line through your user accounts on your Ubuntu box.

48. Transfer files between computers files quickly and securely
With the open SSH server installed and running, you can quickly and securely transfer files to and from the remote computer using the ’sftp’ command. It works just like FTP, and accepts both ‘put’ and ‘get’ for file tranfers. If you prefer a GUI, we recommend using Filezilla on Windows, or ’sftp://’ as a protocol in KDE.

49. Avoid typing ’sudo’
You might have noticed that for almost every important configuration command you type, you need to precede it with ’sudo’ and your password. This can be a real pain if you’re typing one sudo command after the other. Avoid this hassle by typing ’sudo bash’, this transparently replaces the current shell with a new one, complete with administrator privileges.

50. Create a root account
If you find yourself spending more and more time requiring system administration privileges, you may as well enable the root account. Just type ’sudo passwd root’, and enter your password followed by a new one for the root account. You can now type ’su root’ to login as root, but you should only use this mode for essential system maintenance.


continue reading Goto Previous part (4)

Amazing Ubuntu Tips part (4)

31. Tweak your Nvidia settings
After installing the proprietary driver, Nvidia graphics hardware provides exceptional 3D and 2D acceleration for the Linux desktop. You can fine-tune your Nvidia hardware by installing an application called ‘nvidia-settings’, from which you can edit your monitor settings, enable twin displays and add a drop shadow to the cursor.

32. Track down large unused files
Large and scattered files can start to slow your desktop down, as well as any applications that rely on reading the contents of a directory. The best tool we’ve found for consolidating and deleting unused files is called Filelight. It uses a pie chart to show where the largest files are located, and you can easily delete directories of junk from the right click menu.

33. Enable vertical sync in Compiz
Compiz, the 3D whizzy desktop effects application, can be either a resource hog or even an acceleration tool. It depends on the power of your graphics hardware. But we’ve nearly always had better more responsive results on the desktop by enabling the vertical sync option in the general option page of the Compiz settings manager.

34. Don’t Compiz
On the other hand, the wonderful effects that Compiz produces can’t really be described as functional, although they do provide some improved usability for some. You can free up plenty of resources by disabling the desktop effects from the Visual Effects page of the Preferences>Appearance window.

35. Get packages off a CD or DVD
Even in these times of pervasive internet, you sometimes need to be able to install a package without having an internet connection. Fortunately, the Synaptic package manager can read the contents of an Ubuntu installation CD, and add those packages to the database for installation from the drive. Open the Software Sources window from the Administration menu, switch to the ‘Third Party’ page and click on the ‘Add CD-ROM’ button.

36. Boost load speed with Preload
Preload is a tool you can install through the Synaptic package manager. It will run silently in the background, from where it will try to guess which libraries you’re likely to use before you use them. It will then load these into memory so that your applications load quicker. The effects seem to be minimal with recent releases of Ubuntu, but it’s worth a try.

37. Use a virtual desktop
If you enjoy trying different distributions, but have always been put off by the installation, try Virtual Box from the official Ubuntu repositories. It’s easy to use and lets you install a virtual version of almost any Linux installation (and even Windows) right on your desktop, and running at close to native speeds.

38. Boot into text mode
Sometimes, a graphical environment is unnecessary, especially if you use your machine as a server. Which is exactly why there’s a version of Ubuntu called the Server edition. By default, Server has no graphical desktop. But in all other ways, it’s the same Ubuntu. This makes it perfect as a web or media streaming server.

39. Suspend your system
Why wait for your system to boot when you can resume your session from hibernation. This is quicker than booting, and you can continue where you left off. But it’s also dependent on your hardware behaving itself. Just give it a go to see if your hardware supports the feature. Click on the logout button, and if hibernate appears as an option, it should work.

40. Customise your kernel
If you’re feeling really brave (and we’d never recommend this for anyone with too little time on their hands), you could build your own kernel. It’s not as hard as it sounds and it will enable you to add only the features and hardware you’re likely to use. Excellent step by step instructions can be found here: https://help.ubuntu.com/community/Kernel/Compile\

continue reading Goto Part (5) Previous Part (3)

Amazing Ubuntu Tips part (3)

21. Pre-load Konqueror
If you’re always launching KDE’s file and web browser, you can pre-load several instances of it to speed up launch time. Open the Settings>Configure Konqueror window, and switch to the Performance page. Increase the number of instances from 1 to something like 4 or 5. Each instance takes extra system memory, but each session of Konqueror will now load almost instantly.

22. Use Konqueror shortcuts
Konqueror is a great file and web browser with plenty of shortcuts for the power user. Our favourite is the ability to use shortcuts in the location field to perform online searches. Typing ‘wp:linux’ will search Wikipedia for Linux, while ‘gg:linux’ and ggi:linux’ will search Google and Google Images.

23. Launch OpenOffice.org faster
The default OpenOffice.org configuration errs on the side of caution. There are 100 levels of undo, for example, and reducing this number will reduce the amount of memory it uses. This setting can be found from the Options window by switching to the Memory page. Try reducing the undo steps to 30.

24. Use the quick launch toolbar
In both Gnome and KDE, you can drag applications from the launch menu onto the desktop and onto the toolbar. Clicking on these icons is the quickest way of launching your most used applications, short of holding down a certain key combination.

25. Replace slow applications
One of the best things about open source is that there’s always an alternative, and switching to one can vastly improve your system’s performance. Try Abiword instead of OpenOffice.org’s Writer, Thunar instead of Nautilus and Opera instead of Firefox. All are broadly compatible with their alternatives, and perform faster.

26. Rapid application launch
If you know the name of the application or tool you want to launch, you can quickly start it by pressing Alt and F2. This displays a single command-line prompt in a window, and into this you type your application name. Type ‘firefox’ and its icon will appear. Pressing enter will launch it.

27. Take a screenshot
Pressing the Print key will take a screenshot and bring up the save file window. Being able to take a screenshot at any moment is incredibly useful, and is great for saving online order details, for example, or just your high score in Crack Attack. Pressing Alt and Print will take a screenshot of the currently active window.

28. Quickly restart the desktop
Occasionally, you may find that your desktop hangs and you can no longer use the keyboard or mouse. Fortunately, the desktop process is entirely independent of the rest of the operating system, and you can reset the desktop by holding down the Ctrl Alt and backspace keys. But you will still lose any unsaved data, so be careful.

29. Jump to a console
Another option if your desktop has crashed is jumping to a command-line console. Pressing Ctrl and alt, followed by F1-F6 will switch the display to one of six different consoles. From here, you can login and try to kill the process causing trouble, before switching back to your desktop by pressing Ctrl Alt and F7.

30. Create a separate Home partition
When you next perform a fresh installation of Ubuntu, choose the manual partition option and create three separate partitions. One needs to be for ‘/’, and should be around 10-20GB, . Another should be for the swap space, and be around the same size as your installed memory. And the final partition is ‘/home’, and will contain all your personal files. When you next install Ubuntu, choose manual again and your Home partition won’t be reformatted, keeping all your personal files and configuration options in tact.


Continue reading Go to part (4) Previous part (2)

Amazing Ubuntu Tips part (2)

11. Add More Workspaces
Workspaces are one of the best things about Linux. They’re a great way of organising your applications onto different virtual screens. By default, Ubuntu sets up only two, but you can adjust this number by right clicking on the workspace switcher in the bottom right corner of the display and opening the Preferences window.

12. Use Workspaces more effectively
Use ‘Ctrl alt’ and either cursor left or right to switch between adjacent workspaces, and if you hold down the shift key, the active window will move to the new desktop too. For better control, right click on any windows top border to open a context menu, and from here you can choose to move the window to another workspace.

13. Don’t start everything
As with system services, the average Ubuntu installation runs lots of different programs at startup. You can remove those you don’t need by launching the Sessions window from the Preferences menu. If you don’t use the desktop search, for instance, disable ‘Tracker’. Other likely candidates for removal include Bluetooth, the Evolution Alarm Notifier and the Print Queue Applet.

14. Remember the running session
Another neat feature of the setting manager is that you can configure your desktop to remember the applications that were running when you shutdown your machine. This is a great way of quickly launching into your working environment. Just switch to the Session Options page and enable the ‘Automatically Remember’ option.

15. Fine tune the Gnome desktop
Application shortcuts are hidden behind the Gnome equivalent of the Windows registry editor. This can be launched from the command-line by typing ‘gconf-editor’. But be careful, settings changed here could mess up your desktop. If you do, then the desktop can be restored to its default state by deleting the ‘.gconf’ and ‘.gconfd’ folders from your home directory.

16. Launching applications with a key combination
One of the settings hidden in Gconf is the ability to launch applications with a key combination. Navigate to ‘apps>metacity>key_binding_commands’, double click on one of the ‘command_’ entries and enter the launch command for the application you want to run. To set the key, double click on the same entry in ‘apps>metacity> global_keybindings’ and press a key. Holding ‘Ctrl Shift alt’ and that key will now launch the application.

17. Use pervasive searches
Ubuntu comes with an excellent utilities for searchig through the contents of files and emails, but it’s not enabled by default. Open the Search and Indexing window from the Preferences menu, and enable both indexing and watching. After the index has been created, you can search through your files using the ‘Tracker Search Tool’ in the ‘Applications>Accessories’ menu.

18. Switch To A Faster Desktop
Ubuntu uses the Gnome desktop by default. It’s a good choice because Gnome is powerful, capable and popular. But it’s not streamlined or particularly efficient. A faster alternative is XFCE, the source of Xubuntu, and this can be installed through the Synaptic package manager by searching for the ‘xubuntu-desktop’ meta-package.

The KDE desktop

19. Switch to an KDE
If neither Gnome or XFCE are helping you be more productive, then try KDE. It’s the most configurable of the Linux desktops, and often takes a different slant on browsing and file management. Version 4 has vastly improved the environment, and it can be installed by searching for the ‘kubuntu-desktop’ in Synaptic.

20. KDE auto-login
If you prefer Kubuntu or the KDE desktop, then you’ll need to use a different configuration panel to enable auto-login. Open KDE’s System Settings application, and switch to the Advanced page and open the Login Manager. Enter your root password and switch to the convenience page. From here you can choose to enable a user for auto login.


Continue reading Go to Part (3) >>> Go to previous <<<

Amazing Ubuntu Tips part (1)

This tips are use to optimize your ubuntu.

System performance

1. Shorten the boot menu timeout
If you’re fed up of waiting for the boot menu to timeout before your favourite operating system launches, open ‘/boot/grub/menu.lst’ with a text editor and look for the line starting with ‘timeout’. Just lower the number to its the right. This is the number of seconds the menu system will wait before booting the default operating system (0 or 1 is not recommended).

2. Monitor boot performance
One of the best utilities you can install for checking your system’s performance is called ‘bootchart’. After installation and a reboot, ‘bootchart’ will create a complex graph of everything that’s running and taking up resources as your system boots, and place an image of the graph in the /var/log/bootgraph folder.

3. Improve boot speed
When the boot menu appears (you might have to press escape) select the default Ubuntu boot option and press ‘e’. Cursor down to the line starting with ‘kernel’ and press ‘e’ again. You’re now editing the boot parameters, and you need to press space and add the word ‘profile’. Press return followed by ‘b’ to boot. Disk access during your boot sequence will now be profiled, which means that subsequent booting should be faster.

4. Trim unwanted services
The default Ubuntu installation takes an over cautious approach to background services. Bluetooth tools may be be running, for example, even if you don’t have the hardware. Disable the services you don’t need by opening the Services window from the System>Administration menu. Be careful not to disable services you rely on.

5. Monitor CPU usage
You might think that CPU monitors are purely for geeks trying to steal a few extra cycles from their overclocked processors. But this isn’t true. A discreet CPU monitor is the best way detecting a wayward process that’s slowing down the rest of the system. Right click on the desktop panel, and select ‘System Monitor’ for our favourite. There’s a similar applet for KDE.

6. Manage your processes
If you do detect a process on your system that’s stealing more CPU cycles than it really should, then you need to end that process to get those cycles back. Save all your work, and use the Ubuntu process manager. This is part of the System Monitor tool, and this can be opened from the System>Administration menu.

7. Be nice to one another
If you use the System Monitor to manage your running tasks, you might have noticed the ‘nice’ column. ‘nice’ is basically a task’s priority, and ranges between -20 to 19. If you have a CPU heavy task running, such as a 3D calculation for example, increasing the nice will lower its priority, and make your system feel more responsive.

The default Gnome desktop

8. Enable Gnome Auto login
A lot of us are the sole users of our computers, and it makes little sense navigating through a login screen before getting to our desktops. You can enable auto-login for a default account on your Ubuntu machine by selecting ‘Login Window’ from the System> Administration window. Switch to the ‘Security’ page, enable ‘Automatic Login’ and select the user.

9. Prune your menus
The more applications you install, the more cumbersome the launch menu becomes. But you can enable the applications you’re most likely to use right clicking on Ubuntu icon that hides the menu, and selecting ‘Edit Menus’. The application that appears will let you enable or disable menus in the hierarchy.

10. Remove the menu popup delay
HCI gurus insist that there should be a delay between when you click on a menu and when it appears, but if it’s speed you’re after, you can remove the delay. Open a terminal, and type ‘nano ~/.gtkrc-2.0′, then add a single line ‘gtk-menu-popup-delay = 0′. Save this by pressing escape and typing ‘Y’, and after a restart you should find your menus are ultra quick.

Continue reading Go to Part (2)

Thursday, June 4, 2009

Web 3.0


The new version gave information at your fingertips.The second one allowed you to interact with the information.It's tome for the third phase-an intelligent web.
The World Wide Web has entered into its next phase called Web 3.0. The term semantic web bringing in a new paradigm called Web 3.0 . The term semantic web was coined by Tim burners-Lee the man who invented the World Wide Web. In a semantic web, machines can read and interpret web pages just like humans. Today we can link one web page to another but we can't link their data together.As a result, we browse through the links and then look for the right data within those links.
They don't give you the answer to your specific query i.e they don't give up the data, just the links. The Semantic web goes beyond the words and into natural processing.
So the semantic web refers to the technology of precise vocabularies. Through such kind of natural processing has been in progress for years, It's only recently that it started to take off. Some start up like Powerset, Textdigger and Hakia are working on semantic search engines.
A semantic web does not necessarily include artificial intelligence. In stead it relies on structured set of information and inference rules that allow it to understand the relationship between data sources. Another significant aspect of the semantic web is that multiple sites may contribute data about a particular resource..

16 great .htaccess Tricks and Hacks

The .htaccess files (Hypertext Access file) is a very powerful configuration tool on Apache web server. The Apache web server has a number of configuration options that are available to the server administrator. The .htaccess is a simple ASCII text file placed in your website root directory. You can create and edit an .htaccess file using a text editor like notepad.
Here in this blog post I have come up with useful 16 tips and hacks to configure your web server.
As a configuration file .htaccess if a very powerful and a slight syntax error can result in a severe malfunction of your server. So to avoid that always try to keep a backup copies of all your files from the server before working with the .htaccess file.
1. Creating a custom error page with .htaccess on a linux apache is a very simple task. Using you a text editor like notepad you create an .htaccess files. Custom error pages give your website an professional look and catch those visitors who reach your website following a back link.
ErrorDocument 401 /error/401.php
ErrorDocument 403 /error/403.php
ErrorDocument 404 /error/404.php
ErrorDocument 500 /error/500.php

2. How to set the timezone on your server
SetEnv TZ America/Houston

3. Block IPs Using htaccess
Sometime you need to block certain IPs from accessing your entire site or directory. Its pretty simple task. All you have to do is inside the .htaccess file is put the following code.
allow from all
deny from 145.186.14.122
deny from 124.15
If you use the whole IP or a part of the IP to block and add the new ones in a new line.
When someone trying to access your site from the banned ip they will get a 403 error access forbidden message.

4. SEO Friendly 301 permanent redirects for bad/old links and moved links

Redirect 301 /d/file.html http://www.htaccesselite.com/r/file.html

5. Set the Email Address for the Server Administrator - Using this code you can specifying the default email address for the server administrator.
ServerSignature EMail
SetEnv SERVER_ADMIN default@domain.com

6. Hotlinking protection with .htaccess is very important because anyone can hot link to your images and eat up all your bandwith of your server. The following code will help you to prevent that.
Options +FollowSymlinks
# Protect Hotlinking
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?domainname.com/ [nc]
RewriteRule .*.(gif|jpg|png)$ http://domainname.com/img/hotlink_f_o.png [nc]

7. Block all requests from user agent - by creating a perfect .htaccess ban list, you can block all of unwanted user agents that will keep your server load down. Also Check out this interesting thread on webmaster world about the 228 user agents ban list.
## .htaccess Code :: BEGIN
## Block Bad Bots by user-Agent
SetEnvIfNoCase user-Agent ^FrontPage [NC,OR]
SetEnvIfNoCase user-Agent ^Java.* [NC,OR]
SetEnvIfNoCase user-Agent ^Microsoft.URL [NC,OR]
SetEnvIfNoCase user-Agent ^MSFrontPage [NC,OR]
SetEnvIfNoCase user-Agent ^Offline.Explorer [NC,OR]
SetEnvIfNoCase user-Agent ^[Ww]eb[Bb]andit [NC,OR]
SetEnvIfNoCase user-Agent ^Zeus [NC]

Order Allow,Deny
Allow from all
Deny from env=bad_bot

## .htaccess Code :: END




8. Redirect everyone to different site except few IP -If you want to redirect all the visitors to a different IP. Also give access to certain few IPs. You can use the code below
ErrorDocument 403 http://www.youdomain.com
Order deny,allow
Deny from all
Allow from 124.34.48.165
Allow from 102.54.68.123

9. Don’t want to display download request - Usually when you try to download something from a web server you get a request asking whether you want to save the file or open it.
To avoid that you can use the below code on your .htaccess file.

AddType application/octet-stream .pdf
an style="color: blue;">AddType application/octet-stream .zip
AddType application/octet-stream .mov

10. Change the file type - Make any file be a certain kind of file type Makes image.jpg, index.html, default.cgi all act as php


ForceType application/x-httpd-php
SetHandler application/x-httpd-php

11. Block access to your .htaccess file - By adding he following code to your htaccess file will prevent attempts to access your htaccess file. This extra layer of security protects your htaccess file by displaying a 403 error message on the browser.

# secure htaccess file

 order allow,deny
 deny from all

12. Protect access to certain specific file on your server - this can be done by adding the below mentioned code. For example you want to block with the file name default.jpg This will prevent the viewing of this file.

# prevent access of a certain file

 order allow,deny
 deny from all

13. Prevent access to unauthorized browsing - Protecting specific directory browsing can be done by intructing the server to serve a Forbidden and Authorization required message while anyone requests to view that particular directory. Usually if you site doesn’t have a default index page any files within that directory is accessible to the visitors. To avoid that use the following code in the .htaccess file.

# disable directory browsing
Options All -Indexes

14. Setting the default page - You can set the default page of a directory to any page you like. For example in this code the default page is set as about.html instead of index.html
# serve alternate default index page
DirectoryIndex about.html

15. Password protect your directories and files - You can create authentication for certain files and directories from being access. The code has examples of both password protection for a single file and password protection for a entire directory.
# to protect a file

AuthType Basic
AuthName “Prompt”
AuthUserFile /home/path/.htpasswd
Require valid-user

# password-protect a directory
resides
AuthType basic
AuthName “This directory is protected”
AuthUserFile /home/path/.htpasswd
AuthGroupFile /dev/null
Require valid-user

16. Redirect an old domain to a new domain - Using htaccess file you can redirect a old domain name to a new domain by adding the following code into the htaccess file. Basically what it does is it will remap the old domain to the new one.

# redirect from old domain to new domain
RewriteEngine On
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

As htaccess files are very powerful, even a slightest syntax error can cause sever malfunction of your server. So it is crucial to take the backup copies of everything before you try the hacks and tricks on your hypertext access files. Post your thoughts with a comment.

How to run a command in Ubuntu as an administrator without opening a terminal

One of the major drawbacks of starting to learn linux is having to open a terminal every time you want to do anything as an administrator.Here is the tutorial without openning a terminal
  • in Ubuntu, press alt and F2 at the same time. This will bring up a "run application" box.
  • In the "Application Box", type "gksu [APPLICATION OR COMMAND]" where [APPLICATION OR COMMAND] is the command or application you want to run as administrator. the "gksu" will automatically ask you for the password, and will run the command that follows it as an administrator.
  • an example would be wanting to run nautilus, the window manager for Ubuntu, as an administrator, so you can add, edit and delete files in other places than just the home directory. that command would be: "gksu nautilus". This would ask you for your password, and then open nautilus as an admin.
Its best to do most everyday commands without being an administrator, as this limits the user and limits any accidental damage to the operating system or software. Only use this when you need to.

An A-Z Index of the Bash command line for Linux

alias Create an alias
apropos Search Help manual pages (man -k)
apt-get Search for and install software packages (Debian)
aspell Spell Checker
awk Find and Replace text, database sort/validate/index
b
bash GNU Bourne-Again SHell
bc Arbitrary precision calculator language
bg Send to background
break Exit from a loop
builtin Run a shell builtin
bzip2 Compress or decompress named file(s)
c
cal Display a calendar
case Conditionally perform a command
cat Display the contents of a file
cd Change Directory
cfdisk Partition table manipulator for Linux
chgrp Change group ownership
chmod Change access permissions
chown Change file owner and group
chroot Run a command with a different root directory
chkconfig System services (runlevel)
cksum Print CRC checksum and byte counts
clear Clear terminal screen
cmp Compare two files
comm Compare two sorted files line by line
command Run a command - ignoring shell functions
continue Resume the next iteration of a loop
cp Copy one or more files to another location
cron Daemon to execute scheduled commands
crontab Schedule a command to run at a later time
csplit Split a file into context-determined pieces
cut Divide a file into several parts
d
date Display or change the date & time
dc Desk Calculator
dd Convert and copy a file, write disk headers, boot records
ddrescue Data recovery tool
declare Declare variables and give them attributes
df Display free disk space
diff Display the differences between two files
diff3 Show differences among three files
dig DNS lookup
dir Briefly list directory contents
dircolors Colour setup for `ls'
dirname Convert a full pathname to just a path
dirs Display list of remembered directories
dmesg Print kernel & driver messages
du Estimate file space usage
e
echo Display message on screen
egrep Search file(s) for lines that match an extended expression
eject Eject removable media
enable Enable and disable builtin shell commands
env Environment variables
ethtool Ethernet card settings
eval Evaluate several commands/arguments
exec Execute a command
exit Exit the shell
expect Automate arbitrary applications accessed over a terminal
expand Convert tabs to spaces
export Set an environment variable
expr Evaluate expressions
f
false Do nothing, unsuccessfully
fdformat Low-level format a floppy disk
fdisk Partition table manipulator for Linux
fg Send job to foreground
fgrep Search file(s) for lines that match a fixed string
file Determine file type
find Search for files that meet a desired criteria
fmt Reformat paragraph text
fold Wrap text to fit a specified width.
for Expand words, and execute commands
format Format disks or tapes
free Display memory usage
fsck File system consistency check and repair
ftp File Transfer Protocol
function Define Function Macros
fuser Identify/kill the process that is accessing a file
g
gawk Find and Replace text within file(s)
getopts Parse positional parameters
grep Search file(s) for lines that match a given pattern
groups Print group names a user is in
gzip Compress or decompress named file(s)
h
hash Remember the full pathname of a name argument
head Output the first part of file(s)
history Command History
hostname Print or set system name
i
id Print user and group id's
if Conditionally perform a command
ifconfig Configure a network interface
ifdown Stop a network interface
ifup Start a network interface up
import Capture an X server screen and save the image to file
install Copy files and set attributes
j
join Join lines on a common field
k
kill Stop a process from running
killall Kill processes by name
l
less Display output one screen at a time
let Perform arithmetic on shell variables
ln Make links between files
local Create variables
locate Find files
logname Print current login name
logout Exit a login shell
look Display lines beginning with a given string
lpc Line printer control program
lpr Off line print
lprint Print a file
lprintd Abort a print job
lprintq List the print queue
lprm Remove jobs from the print queue
ls List information about file(s)
lsof List open files
m
make Recompile a group of programs
man Help manual
mkdir Create new folder(s)
mkfifo Make FIFOs (named pipes)
mkisofs Create an hybrid ISO9660/JOLIET/HFS filesystem
mknod Make block or character special files
more Display output one screen at a time
mount Mount a file system
mtools Manipulate MS-DOS files
mv Move or rename files or directories
mmv Mass Move and rename (files)
n
netstat Networking information
nice Set the priority of a command or job
nl Number lines and write files
nohup Run a command immune to hangups
nslookup Query Internet name servers interactively
o
open Open a file in its default application
op Operator access
p
passwd Modify a user password
paste Merge lines of files
pathchk Check file name portability
ping Test a network connection
pkill Stop processes from running
popd Restore the previous value of the current directory
pr Prepare files for printing
printcap Printer capability database
printenv Print environment variables
printf Format and print data
ps Process status
pushd Save and then change the current directory
pwd Print Working Directory
q
quota Display disk usage and limits
quotacheck Scan a file system for disk usage
quotactl Set disk quotas
r
ram ram disk device
rcp Copy files between two machines
read read a line from standard input
readonly Mark variables/functions as readonly
reboot Reboot the system
renice Alter priority of running processes
remsync Synchronize remote files via email
return Exit a shell function
rev Reverse lines of a file
rm Remove files
rmdir Remove folder(s)
rsync Remote file copy (Synchronize file trees)
s
screen Multiplex terminal, run remote shells via ssh
scp Secure copy (remote file copy)
sdiff Merge two files interactively
sed Stream Editor
select Accept keyboard input
seq Print numeric sequences
set Manipulate shell variables and functions
sftp Secure File Transfer Program
shift Shift positional parameters
shopt Shell Options
shutdown Shutdown or restart linux
sleep Delay for a specified time
slocate Find files
sort Sort text files
source Run commands from a file `.'
split Split a file into fixed-size pieces
ssh Secure Shell client (remote login program)
strace Trace system calls and signals
su Substitute user identity
sudo Execute a command as another user
sum Print a checksum for a file
symlink Make a new name for a file
sync Synchronize data on disk with memory
t
tail Output the last part of files
tar Tape ARchiver
tee Redirect output to multiple files
test Evaluate a conditional expression
time Measure Program running time
times User and system times
touch Change file timestamps
top List processes running on the system
traceroute Trace Route to Host
trap Run a command when a signal is set(bourne)
tr Translate, squeeze, and/or delete characters
true Do nothing, successfully
tsort Topological sort
tty Print filename of terminal on stdin
type Describe a command
u
ulimit Limit user resources
umask Users file creation mask
umount Unmount a device
unalias Remove an alias
uname Print system information
unexpand Convert spaces to tabs
uniq Uniquify files
units Convert units from one scale to another
unset Remove variable or function names
unshar Unpack shell archive scripts
until Execute commands (until error)
useradd Create new user account
usermod Modify user account
users List users currently logged in
uuencode Encode a binary file
uudecode Decode a file created by uuencode
v
v Verbosely list directory contents (`ls -l -b')
vdir Verbosely list directory contents (`ls -l -b')
vi Text Editor
vmstat Report virtual memory statistics
w
watch Execute/display a program periodically
wc Print byte, word, and line counts
whereis Report all known instances of a command
which Locate a program file in the user's path.
while Execute commands
who Print all usernames currently logged in
whoami Print the current user id and name (`id -un')
Wget Retrieve web pages or files via HTTP, HTTPS or FTP
write Send a message to another user
x
xargs Execute utility, passing constructed argument list(s)
yes Print a string until interrupted
. Run a command script in the current shell
### Comment / Remark

Linux SSH (Secure Shell) terminal command

In most forms of Linux, you can use the SSH (Secure Shell) terminal command to connect to a remote machine running an OpenSSH server. The basic format is something like this:

ssh machinename/IP address

So, if you wanted to SSH to a machine with the IP address of 192.168.1.2, you’d use this command:

ssh 192.168.1.2

Normally, you’ll then be asked to specify a username and a password. However, you can use the SSH command-line client to pick a username beforehand:

ssh -l username 192.168.1.2

A common security measure on an OpenSSH server is to change the default TCP/IP port. By default, OpenSSH listens for requests on port 22, which means many automated cracking attempts target port 22. Changing OpenSSH’s listening port will default some of the automated attacks, which means you’ll need to specify a different port when accessing the machine. Fortunately, this is quite easy to do. For instance, if the OpenSSH server at 192.168.1.2 had been configured to use port 1453:

ssh -p 1453 192.168.1.2

Finally, SSH usually works smoothly, but sometimes there can be problems. Switching SSH to verbose mode causes it to produce longer error messages, which can be useful in tracking down obscure problems:

ssh -v 192.168.1.2

Ubuntu tricks, OpenOffice

I finally managed to fix the color issues on Openoffice. Indeed, when messing around with the gtk colors, you will notice that openoffice doesnt like it at all. So here is the fix :

Write this in a terminal:sudo gedit /usr/lib/openoffice/program/soffice
Then insert a new first line and write this on it:export GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc
Then save it and close gedit.
Make sure that every OpenOffice-application is shut down. Then try to start a new one to see if it works.

Note that Clearlooks can be replaced by any other theme. This will force openoffice to use that theme and keep the colors from being corrupted by your current gtk colors.