Google Community
Latest Forums Rules Resources
Custom Search

Go Back   Google Community > Webmaster Forums > Web Design, Coding & Programming Forum

GoogleCommunity Sponsor
Cirtex Hosting
Use coupon "forum" for 50% Off!

Reply
 
LinkBack Thread Tools Display Modes
Old 05-06-2005, 12:51 AM   #1 (permalink)
Noogle
 
Join Date: Apr 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
puccavn
.htaccess tutorial

1) .htaccess IP Blocking

Ever wanted to stop someone getting on your site? And you somehow fount out their IP address? Well here's how using the .htaccess file technique.

Here's the code:
deny from <ip>

Simply replace <ip> with the user's IP that you wish to ban, and they will be unable to get onto your site.

2) Redirecting your pages using .htaccess

This tutorial will simply just show the command used to redirect using the .htaccess file.

To redirect simple paste the following code into the file:
Redirect /pootash.html http://www.vip-game.com

This simply redirects anyone trying to get to the "pootash.html" file in the directory to http://www.vip-game.com

3) Custom error pages using .htaccess
Introduction
We've all seen the dreaded Error 404 message - the result of broken links and mistyped URLs. You've probably been on some websites where the error pages are customised with their own logo and message, and I'm sure you'll agree that it looks far more professional than the standard one.

In this article we'll show you how to use Apache's .htaccess file to make your own customised error 404 pages.

Create the .htaccess file
Create a new text file on your computer, and call it "htaccess.txt". Enter the following lines:

<Files .htaccess>
order allow,deny
deny from all
</Files>

ErrorDocument 404 /errordocs/error404.htmThe first part stops people viewing your .htaccess file. The second part tells Apache to redirect any 404 errors to the file "error404.htm".

Create the 404 page
Now you need to create the 404 page. Make a new web page called "error404.htm" and enter "This is my 404 page". Enter it a few dozen times, as Internet Explorer won't display it unless the file is over 512 bytes.

Once it's done, login to your webspace with your FTP client, and create a new folder called "errordocs". Upload the file "error404.htm" to this directory. Upload "htaccess.txt" to the root of your webspace and rename it to ".htaccess" — there's no .txt at the end, no name in front, just ".htaccess". If the file seems to vanish don't worry, some FTP clients don't display it — the file's still there.

Trying it out
Now you need to see if it works. Type the URL of your website in your browser and add a random file name at the end. Something like "http://www.yoursite.com/dgsgdgsdgdsgg.htm".

If everything has worked properly, you should now be seeing your custom error message. If not, then it's possible your web host doesn't allow you to have your own .htaccess files. You may want to contact them and ask.

If it worked then you can now make a proper 404 page. You can have your own images, text, in fact anything else you can have in a normal web page. The best 404 pages have the site logo and a few simple lines explaining what's happened. If you have a site search, you could put that on it too in order to help visitors find what they're looking for.

Taking it further
There's several other error documents that you might wish to customise.

400 - Bad request
401 - Authorization Required
403 - Forbidden directory
404 - Page not found
500 - Internal Server Error

For each one you want to use, simply add a line to your .htaccess file and create the corresponding page.

<Files .htaccess>
order allow,deny
deny from all
</Files>
ErrorDocument 403 /errordocs/error403.htm
ErrorDocument 404 /errordocs/error404.htm
ErrorDocument 500 /errordocs/error500.htm
puccavn is offline   Reply With Quote
 
Sponsored Links
Old 08-19-2005, 09:56 AM   #2 (permalink)
Noogle
 
Join Date: Aug 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
turker
Hello, I have a vbulletin forum, and want my URLs to seem like yours, I mean, http://www.googlecommunity.com/post-53246.html#53246

as HTML, as it's easier to be crawled by googlebot.

How can I convert URLs like below,
http://www.site.com/forum/showthread.php?t=1137
http://www.site.com/forum/showthread...newpost&t=1097
http://www.site.com/forum/showthread...=3325#post3325
http://www.site.com/forum/forumdisplay.php?f=127

into the ones like:
http://www.site.com/forum/forumdisplay/127.html

I'll be very happy if you can help.
turker is offline   Reply With Quote
Old 08-22-2005, 02:29 AM   #3 (permalink)
Master Googler
 
JOKERz's Avatar
 
Join Date: Aug 2005
Location: Grave
Posts: 558
Thanks: 0
Thanked 0 Times in 0 Posts
JOKERz
Wooohooooo!!! puccavn you cool man!!!
Thanx for the info about .htaccess
JOKERz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help for .htaccess anversli Web Design, Coding & Programming Forum 2 09-03-2006 01:21 AM
.htaccess Password Protection puccavn Web Design, Coding & Programming Forum 0 05-06-2005 12:52 AM
Another Tutorial Magicdka Graphics Design Forum 0 10-26-2004 10:10 PM
New Tutorial Magicdka Graphics Design Forum 3 10-25-2004 02:31 PM


All times are GMT -8. The time now is 12:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004–2007 Google Community