Welcome to WeetHet!


Managed Web Hosting by Liquid Web

Your IP address:
3.239.6.58
     
 
Print this page
- use Landscape
Search the
WeetHet Pages
WeetHet is being updated! - Current articles will slowly move to www.tweaking4all.com
For excellent webhosting that is reliable and affordable, we highly recommend: LiquidWeb

On this page ...

Some webhosts (and some Internet Providers) allow you to either use Frontpage Extensions or a so called .htaccess file.

I have never used the Frontpage Extensions, since I really hate Frontpage as an editor for my webpages, instead I use Dreamweaver. So no Frontpage Extensions for me. Instead I use the so called .htaccess file.

So what can we do with the .htaccess file?

Well, we can create custom error pages, automatically redirect obsolete links, regulate access, etc.

Note: Not all providers offer the use of the .htaccess file, please contact your provider and ask him if this is supported.

Warning: Frontpage is not handling the .htaccess files well!

Note: You can define an .htaccess file for each folder, over-ruling the root .htaccess file!

Note: Some dedicated servers expect you to use absolute paths, so instead of /bla.htm you should use http://www.yoursite.com/bla.htm.

HTML

.htaccess file - Overview

This strangely named file is they key to getting the most out of your virtual server. Actually, the filename makes pretty good sense once you know that files that start with a dot, are hidden files in a Unix-like environment, and that 'ht' is derived from 'HTTP', and well access from access.

The .htaccess file is basically a text file with some instructions, stored somewhere on the server (preferably in the root of your website).

Deny access to certain IP-addresses

You can deny access to certain IPs. If you don't want someone to access your site place the following code into your .htaccess file:

<Limit GET>
order allow,deny
deny from 123.456.789.0
deny from 123.45.67
allow from all
</Limit>

This code will block 123.456.789.0 IP and all others that are starting with 128.45.67. Everybody else will be able to access your site. You can block as many addresses as you want.

Define my default webpage

Most servers have index.html as their default page. This means that when you access http://www.weethet.nl/, you will automatically be redirected to http://www.weethet.nl/index.html.

Let's say you want the default to be start.html. All you need to do is to add the following line to your .htaccess file:

DirectoryIndex start.html

Automatically redirecting users to another page

It may be necessary to redirect a user from one page to another.

Commonly this is needed when you have restuctured your website and gave some files a new location, or - like I did - had to rename all files because I started using ASP.

Without a redirect, the user will encounter a 404 File Not Found Error from you site. This is not very usefull to the visitor, you'd rather redirect him or her to the new location or new file that replaces the old one, so the visitor can see the info they are looking for.

File to File redirection

You could go for a little JavaScript (see Autoredirect in HTML) or rather simple by adding a line to your .htaccess file:

Redirect /oldpage.htm /newdirectory/newpage.php

You can add as many lines as necessary, just keep it in the same format. You can also redirect several pages to one main page. I used that for showing the error, informing the user to update their bookmakrs and to automatically redirect to the actual page. Click here to see a life example.

Directory to Directory redirection

Suppose you used to have a directory /dutch/content, but you moved the files to /blabla/textfiles. This means that each URL with "/dutch/content/" should be replaced with the same lnk with "/blabla/textfiles/" instead:

Redirect /dutch/content/ http://www.weethet.nl/blabla/textfiles/

Iedere link waarin dus staat http://www.weethet.nl/dutch/content/, wordt veranderd naar http//www.weethet.nl/blabla/textfiles/

Als voorbeeld;

je wilt de pagina http://www.weethet.nl/dutch/content/search.php openen.
De redirect maakt daar dan van http://www.weethet.nl/blabla/textfiles/search.php.

Filetype to filetype redirection

This one looks a bit more complicated. Say you want to redirect all ASP pages (*.ASP) to PHP pages (*.PHP).

RedirectMatch (.*)\.asp$ http://www.weethet.nl$1.php

Here each *.asp link will be redirected to the same link, now with the .php extension. Basically it says:

zero or more random characters (="(.*)\") ending with .asp (=".asp") at the end of the line (="$"), should be redirected to http://www.weethet.nl (="http://www.weethet.nl") with the same link as the found string minus the .asp extension (="$1") with a .php extension (=".php").

Preventing someone from viewing my .htaccess file

The .htaccess file typically resides in your root directory and can be viewed through the web browser. Most of the time there is information contained the the .htaccess file that you don't want people knowing, like the rules for allowing or denying access. One way to prevent access to the .htaccess file is to disable access to that particular filename. You can add the following lines to your .htaccess file in the root directory to deny visitors from viewing all .htaccess files contained in your website:

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

Prevent someone from linking to my downloads

This may sound a bit sick and sad, but now-a-days, one get's billed for the bandwidth used, so if others do not wish to have these costs (or they are to lazy) they might link to the files on your site rather than linking to your website in general.

This text refers to an .htaccess file inside your download directory!

Add these lines to your .htaccess file and stop people from linking to your downloads and claiming it is theirs. You can also redirect them to another page of your choice.

AuthUserFile /dev/null
AuthGroupFile /dev/null
RewriteEngine On
RewriteCond %{HTTP_REFERER} !>http://www.example1.com [NC]
RewriteCond %{HTTP_REFERER} !>http://example1.com [NC]
RewriteCond %{HTTP_REFERER} !>http://www.example2.com [NC]
RewriteCond %{HTTP_REFERER} !>http://www.example3.com [NC]
RewriteCond %{HTTP_REFERER} !>http://123.123.123.123 [NC]
RewriteRule /* http://www.example.com/index.html [R,L]

"http://www.example1.com" (example2, etc.) is the URL where the downloads can occur.

The numbers 123.123.123.123 is your IP address for your site.

"http://www.domain.com/page.htm" is the page that an unauthorized person is redirected to. Be sure to keep the syntax in place and only change the URL's to your domain.

This will stop the download of any files in it's directory. You should create a separate directory for your downloads. If you place this file in the root directory you will be redirecting them to your RewriteRule page.

Custom error pages

I suspect we've all seen this before:

404 - File Not found

The requested URL /someone/mistyped/a/link.html was not found on this server.

But we've probably all run into a page like the following too:

BM logo

Oops! You've found a bad link!

You will be redirected automatically to our main page.

These pages are examples of Error Documents. The top example is the standard error (404 - File Not Found), and the bottom example is an example of what you can replace it with. You can even have one for each directory if you want. Often these pages have a link back to the referering page or a link to the new location of an old page.

Most types of errors that the web server can run into have error numbers. For example "File Not Found" is error 404. (List of Errors below) The specification of an error document is easy. You add "ErrorDocument", the three digits of the error number and the either the error string or the page to go to. The following examples show the three forms:

ErrorDocument 404 http://www.domain.com/404.html
ErrorDocument 401 /401.html
ErrorDocument 500 errors.php?error=500.html

Error List

Client Error
Number Description
400
Bad Syntax
401
Unauthorized
402
Not Used
403
Forbidden
404
File Not Found
   
Server Error
Number Description
500
Internal Server Error
501
Not Implemented
502
Server Overloaded
503
Gateway Timeout

Avoid directory browsing

Som websites allow you (this is a defaut setting!) to browse directories on your webserver by simply entering URL+directory name in a webbrowser. Usually this is not something you would want. Copy the following line into the .htaccess file found in the root of the website, it will disable this browsing feature.

Options Includes FollowSymLinks

 


 

 


Klik hier om te wisselen naar nederlandstalige pagina's You are currently on the English pages.
Help & AboutWelcome ... !!GuestbookWeetHet HelpGlossary ...Searching the InternetSearching WeetHetAvailable downloadsNews & UpdatesStatisticsDisclaimer!AdvertisingJoin us !!!AwardsAbout WeetHet ...Hansie goes USAWhere is Hansie?First monthsMy new homeGoing outPuck goes USAMy new carSnapshots PuckRandom snapshotsFinally: Spring!Nice warm summerFirst Family visit!CD's and DVD'sMusicAudio-DVD to MP3Music CD to MP3Music CD to WAVCopy Music CDYour own Music CDMusic from the InternetChanging MP3 VolumeNero Burning RomBurn BIN/CUE filesConvert BIN to ISOComputer CDRomBurn ISO filesPhoto VCDPhoto SVCDNero vs Nero ExpressNRG to ISOBurn SVCDSVCD with menuBurn VCDVCD with menuDVD VideoWhat are RegionCodes?What is MacroVision?Video formatsDIKO: 3 AVIs - 1 DVDHow does a CD work?How to burn a CDCreating a DVDConvert BIN to ISONRG to ISOCreating a disk catalogComputer InfoHow does a CD work?Netiquette: E-MailWhat is DivX?What is MP3?What is RAID?What is USB?What are PAR files?Wireless LAN introPC to TV cablesStart XP fasterBoot from USB driveFireWire connect 2 PC'sPhoto SizingGraphics / PhotosPhotoshopPhoto SizingFast car3D buttonsDraw lightningPhotos on CDPictureToTVVideoCD with NeroSVCD with NeroMagix Pictures on CDDVD PictureShowPhoto SizingPhoto SizingGSM / PDAsCompaq iPAQReplace batterySerial craddle to USBGarmin eTrex cableGarmin eTrex plugRound Garmin plugPalmPilotConnect Ericsson GSMGarmin eTrex GPSMobile phonesEricsson RingtonesMusicBoxRingtonesMasterA edit SIMSMSC numbersConnector pinoutsHardware & HacksOverclocking CPU'sGenericAMD CPU codesAMD Slot-AAMD Socket-AProgr. SmartcardsMillenniumAlcatel HackLCD display to PCNetwork cablesBoot from USB drivePC to TV cablesPromise Ultra -> RAIDSoundblaster MIDIResistor colorcodeFireWire NetworkInternetNetwork genericEnabling DHCPWin95/98/ME ClientWin2000/XP ClientMac OS 7/8 ClientMac OS X ClientWell known IP-portsDNS addressesNetwork cablesWireless LAN IntroFireWire NetworkDialup connectionTCP/IP optimized for Win9xPublic IP Address?ADSL / MxStreamADSL in generalHow ADSL worksDNS addressesMXStreamInstallingPSTN EthernetISDN EthernetRouter for MXStreamSMC 7404 WBRA/BeTech ModemRoutereTech RouterSitecom 4S routerVigor 2200E routerSolving problemsAlcatel HackHack the modemPassword CalculatorPurpose of the LEDsSolving problemsFirmware upgradeDNS addressesWell known IP-portsMapping PortsAutoPortMappingConnection sharingPossibilitiesWinRoute (software)Network Win95/98/MENetwork Win2000/XPNetwork Mac OS 7/8Network Mac OS XWell known IP-portsWireless LAN IntroNetwork cablesRoutersSMC 7404 WBRA/BeTech ModemRoutereTech RouterSitecom 4S routerVigor 2200E routerInternet by SatelliteHow does it work?Brief intro ...Overview variantsStandardBySky methodTwo-Way InternetInstalling cardsWhich satellite-card?PC requirementsHarmonic CyberstreamPentam. Pent@VisionHauppauge DVBs NexusTechnotrend PCLineEOL problemsNew driversMounting a dish (Astra)Dish size?EON ChecklistTransponders EOLRamdisk for FazztYour own webpageNavigation solutionsInsight and solutionsApyCom apPopupMenuD.Binard PopupMenuPopupMenu generatorPopupMenu flatTips and TricksE-Mail linkE-Mail FORMBookmark this pageIcon for my webpage'Page back' link?Jumping within a pageEscape from framesUse frametitleControlling framesAuto redirectFixing 100% problemChange link colorText in the statusbarFixed backgroundText over imagesBrowser safe colorsUsing the .htaccess fileSpecial charactersWhere to downloadIRC using mIRCInstalling mIRCDownload Movies etcFAQMovies from InternetMovie QualityWhat are PAR files?LeechGuyLeechGuy editoreMuleWinMXE-MailNetiquetteQuote of the dayMiscellaniousHack Arescom NetDSLWireless LAN IntroFireWire NetworkWell known IP-portsWhat is my IP Address?Search (WeetHet)Searching (Internet)WeetHet DownloadsA few great websitesDNS addressesMicroControllersBasic Stamp IIStarting with the BS2Assembling the kitFullsize scematicsConnection to your PCBS2 to 44780 LCD44780 LCD SnapshotsBS2 to M50530 LCDM50530 SnapshotsHomebrew BS2Smartcards/SIMProgrammer Softw.CardMasterInfinityUSBMasterBurnerMilleniumCard TypesEdit GSM SIMResistor colorcodeMusic / AudioMusic from InternetIntroductionLeechGuyLeechGuy editorWinMXeMuleUsing mIRCBurn BIN/CUE filesConvert BIN to ISOAudio-DVD to MP3How does a CD work?Copy music CDYour own music CDWhat is MP3?Music CD to MP3MP3 CD for Yamakawa?Changing MP3 VolumeMusic CD to WAVSB MIDI interfaceAC3 to WAV/MP3ProgrammingBorland DelphiHansies Delphi ToolsAYeah!CatalogQuote of the dayPopupMenu generatorOverview ASCII chars.Satellite (TV & GPS)Satellite TelevionSatellite TV on the PCTV reception on your PCPC requirementsNew driversPentam. Pent@VisionHauppauge DVBs NexusTechnoTrend PCLinePVA file to MPEG2DirecTV TiVoRemote ControlDirecTiVo to OS6.21: Intro & Images2: TiVo disk in PC3: Install OS 6.24: OS6.2 first start5: SuperPatch & More6: Recordings to PCTyTools - Movies to PCOld: DirecTiVo to OS4Old: Sleeper HackSmartcardsProgrammer Softw.CardMasterInfinityUSBMasterBurnerMilleniumCard TypesWhat is DiSEqC?Mounting a dish (Astra)Dish sizeSRT8000 firmwareGPS NavigationGarmin eTrexDiagnostic modeSerial connectionConnect to iPAQ 36/38xxConnect to PalmPilotThe eTrex connectorThe round connectorHow GPS worksGeoCaching explained ...Internet by SatelliteHow does it work?Brief intro ...Overview variantsStandardBySky methodTwo-Way InternetInstalling cardsWhich satellite-card?PC requirementsHarmonic CyberstreamPentam. Pent@VisionHauppauge DVBs NexusTechnotrend PCLineEOL problemsNew driversMounting a dish (Astra)Dish size?EON ChecklistTransponders EOLRamdisk for FazztVideoVideo guide - start hereIntroductionGSpot: AVI InfoDIKO: 3 AVIs - 1 DVDDownload QualityVideo in generalWhat is DivX?Video formatsRecording TypesWhich AVI codecs?Intro K(S)VCD/KDVDDVD+RW IssuesAbout bitratesVideoServer pluginWhat are RegionCodes?What is MacroVision?RippingAudio-DVD to MP3Photo SizingAVI to MPEGGSpot: AVI InfoDIKO: 3 AVIs - 1 DVDAVI to DVD/(S)VCDWithout SubsD.I.K.O.MainConcept (S)VCDNero Vision Express 2TMPGEnc (S)VCDTMPGEnc K(S)VCDTMPGEnc with AC3With SubTitlesD.I.K.O.MainConcept (S)VCDNero Vision Express 2TMPGEnc (S)VCDTMPGEnc K(S)VCDTMPGEnc with AC3Burning CD NeroBurn VCDVCD with menuBurn SVCDSVCD with menuBurn BIN/CUE filesDVD PlayersCompatibilityAdd DVD playerDVD+RW IssuesIntro K(S)VCD/KDVDVideo ToolsBitrate CalulatorDVD RippingGSpot: AVI InfoFlaskMPEG and CCEVideoServer pluginDVD to DivXIntroductionCalculating bitratesRippingDVDx and SmartRipperDVDx settingsFlaskMPEG method 1FlaskMPEG method 2FlaskMPEG method 3DVD to (S)VCDIntroductionCalculating bitratesRippingDVDx and SmartRipperDVDx settingsFlaskMPEG 0.6 and CCEDVDx and Video ServerDivX to (S)VCDDVD to DVDDVD2OneDVDShrinkDVD+RW IssuesTMPGEnc & CoDIKO: 3 AVIs - 1 DVDMovie Cut & PasteGSpot: AVI InfoMergingMPEG1 and MPEG2Using TMPGEncWomble MPEG2VCRAVI with VirtualDubCuttingNewWith TMPGEncWomble MPEG2VCREasy Video SplitterAVI en DIVXAVI with VirtualDubEasy Video SplitterMovies from InternetIntroductionLeechGuyLeechGuy editoreMuleWinMXUsing mIRCWhat are PAR files?Burn BIN/CUE filesConvert BIN to ISOPictures on CDPictureToTVVideoCD with NeroSVCD with NeroMagix Pictures on CDDVD PictureShowRipping SubtitlesVobsub: fast and easy!SubRip (OCR)Sync subtitlesDisplaying subtitlesDisplaying with VobSubSync subtitlesCreate a MicroDVDPC connected to TVPC to TV cablesATI softwarenVidia softwareTiVo - Harddisk VCRTiVo Series 1What is a TiVo?Opening a TiVoSerial accessDebug Mode accessLinux Bash shellSet the clockDisable dialupDirecTV TiVoRemote ControlDirecTiVo to OS6.21: Intro & Images2: TiVo disk in PC3: Install OS 6.24: OS6.2 first start5: SuperPatch & More6: Recordings to PCTyTools - Movies to PCOld: DirecTiVo to OS4Old: Sleeper HackYamakawa 713/715IntroductionFAQThe Remote ControlSecret codesSet regioncodeSet regionfreeDisable MacroVisionFactory-settingsWhich DVDRom driveFirmware versionChange firmwareDownload firmwareChange backgroundCreate MP3 CDM.U.F.Y. MP3 CD'sHelpForumSearch (WeetHet)Search (Internet)News & UpdatesGlossary ...DownloadsLinksStatisticsAdvertisingJoin us !!!Guestbook

Liquid Web Fully Managed Web Hosting