The web and technology blog

.htaccess – A quick guide

.htaccess , Whats is it?

According to Apache:

.htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof

‘Directives’ usually refer to the commands that are contained in the .htaccess files, which control or modify your server’s various behaviours. Many free and paid web hosts permit you to change and modify your .htaccess files but remember if you have a website running on Yahoo Geo Cities,Goolge sites or freewebs then this article is meaningless for you cause they dont allow access to .htaccess files

What can you do with .htaccess?

.htaccess can be used in many different creative ways , but its most common usage is for:

  • Setting up custom 404 error pages
  • Enable/Disable directory browsing
  • Change default homepage for a directory
  • Block certain users from accessing your site
  • Block specific refferers
  • Prevent certain files from being viewed
  • Block Hotlinking

How to create one?

Create a text file from any text editor, Note Pad,Text Pad and save it as .htaccess ( remember the period before htaccess and no .txt extension ).
Upload it in your home directory…The rules in .htaccess file apply to all the sub directories in your files directory

Doing some cool stuff

Now here comes the real thing…
To enable your server to use a custom 404 file not found page for broken links or URL typos…
include the following code in your .htaccess file:

#The page notfound.html should be in the same directory as your .htaccess ErrorDocument 404 /notfound.html #Alternatively you can specify just raw html to be used instead of a page ErrorDocument 404 "<h1>yikes! that  page passed away a while ago...</h1>"

Enable / Disable directory browsing

Options +Indexes
## Block some specific file types from showing
IndexIgnore *.avi *.mp3 *.pdf


Change directory homepage

##the pages are used in order
DirectoryIndex myhomepage.html index.html index.php

Block some users from accessing your site

<limit GET POST PUT>
order deny,allow
deny from 202.54.122.33
deny from 8.70.44.53
deny from .hackers.com

allow from all
</limit>

Display your visitors IP address using php

The following line of code shows your visitors their IP address,

<?php echo $_SERVER['REMOTE_ADDR'] ?>

For knowing what all super globals are available for you use the function phpinfo(); or print the complete $_SERVER array using print_r($_SERVER);

Generate HTML formatted scraps via Scrapground.co.cc


Do you use Orkut?
If so then you might be loving sending fun, html formatted scraps…
here is a little tool that creates your scrap in beautiful 44 different templates:
http://www.scrapground.co.cc
the same tool is also featured at http://www.cluborkut.co.cc
Just enter your scrap and hit enter, copy and paste the source code generated….and have fun :-)

Update :
Scrapground.co.cc and Cluborkut.co.cc are no more ! :(
my free hosting accounts got terminated for inactivity…

Get a free domain with top class free web hosting!

Are you a desperate blogger/webmaster stuck with your free webhost where server crashes thrice a day and a freedomain that is ignored by search engines? Are you looking for free domain with free hosting but dont know where to go? Well then BuddingBloggers is the right thing for you. BuddingBloggers ,as the name suggests is helpful for growing bloggers who dont have a domain of their own. Now you might be wondering what maybe the procedures or criteria for getting a free domain via this service, well the good news is, BuddingBloggers doesnt require you to put some work into it or first complete some sponsored criteria(s) or purchase any service to be liable to recieve a freedomain( as other free domain services do) .Instead ,BuddingBloggers is completely free without any hidden costs, all you gotta do is fill out the application form here : http://buddingbloggers.com/apply and if you are lucky and enough you might get selected for the sponsorship program.but brfore make sure you have read and understood the program guidelines which you can find here : http://buddingbloggers.com/blog/program-guidelines/

Cheers and happy blogging! :)

Free RED beautiful powerpoint template

Download free powerpoint template

Download free powerpoint template

This beautiful free powerpoint template comes ready with two slides with awesome vista-like background.

Just download and make that beautiful impressive presentation

Download Free powerpoint template