Search:     Advanced search
Browse by category:
Glossary

.htaccess file - What is it used for, how to set php memory, how to setup dynamic urls, how to setup redirects

Views: 2175
Votes: 3
What they are/How to use them

Technical Definition

.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.

Simple Definition

It's a file that allows you to make changes to the way php/apache behaves and to it's resources.

Things you can do: (by placeing these lines within the .htaccess file) one per line.

Alter / increase the memory allocation for php:

php_value memory_limit 20M

Redircect one page or directory to another

Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html

You can also place codes after the word Redirect which will tell search engines and browser how they are to handle the redirect:

Redirect 301 - moved permanently

    * 301 - Moved Permanently
    * 302 - Moved Temporarily
    * 403 - Forbidden
    * 404 - Not Found
    * 410 - Gone

# seo friendly redirect for a single file
Redirect 301 /old-dir/old-file.html http://domain.com/new-dir/new-file.html

# seo friendly redirect for multiple files
# redirects all files in dir directory with first letters xyz
RedirectMatch 301 /dir/xyz(.*) http://domain.com/$1

# seo friendly redirect entire site to a different domain
Redirect 301 / http://different-domain.com

Setting MIME types in .htaccess

Add the following line format:

addtype mimeType fileExtension

Examples:

addtype text/vnd.wap.wml wml
addtype application/vnd.wap.wmlc wmlc
addtype image/vnd.wap.wbmp wbmp
addtype text/vnd.wap.wmlscript wmls
addtype application/vnd.wap.wmlscriptc wmlsc
addtype application/vnd.wap.xhtml+xml xhtml
Others in this Category
document Site Map Generator - how to automatically get a google sitemap for your website
document 32 bit counters in ifconfig, difference in ifconfig and router traffic for root server.
document Preventing caching or (no caching) of a website
document Do we put adverts on your website?
document What level of support to we offer?
document Cpanel disk used incorrect showing unlimited or 0MB
document cPanel commands run from root.
document How to setup a mailman mailing list in cpanel
document ulimit - linux root command. MAN, howto
document How can I make my website rank highly on search engines?
document How to uninstall a windows service.
document Exim White List WHM 10 tutorial
document http://www.ietf.org/rfc/rfc2821.txt
document cPanel FAQ for VPS
document I have uploaded new information onto my site, but still see the old content.
document Exim Cheat Sheet
document How to enable register globals
document Linux root commands
document How to change server time/timezone linux
document How to import and export a mysql database as root
document How to kill SSH session as root, how to disconnect other ssh sessions linux
document Tutorial - how to use recursive grep and find to write output to a file in linux.
document TAR tutorial: backup and tar specific files only - recursively
document Black Lists like Sorbs Suck
document Change the IP exim uses to send mail - bypass sorbs (or other useless blacklists)
document Access database (mdb) in Plesk - How to setup a access database in plesk
document ASPmail code example tutorial
document Disable mod_security for one account or domain
document Cpanel Fix: Error from domain wrapper: .... is owned by another user.
document Tutorial: Fix failed named in cpanel
document Simple Guestbook cpanel - manually remove entries or comments - howto
document netstat linux commands
document Bash programming (the FOR function)
document Restore defaced accounts or hacked account index pages cpanel
document Install yum on VPS VZ from main node
document Kayako support emails stopped being delivered
document How to contact, tel number for hello peter



RSS

Del.icio.us Facebook Technorati Digg Furl
TEL : +27 (0) 21 3000 213

SHARED HOSTING

South African Hosting
Unlimited Web Hosting
Business Level Email
Email Only

RESELLER HOSTING

Unlimited - PHP MySQL
Overselling - PHP MySQL

DEDICATED HOSTING

VPS - Dedicated Root Servers

DOMAIN REGISTRATION

Register a Domain Name

 

 

ABOUT US

Contact Details
About Us
Terms and Conditions
Hosting Affiliate Program

 

Providing superior web hosting services. Tel: +27 (0)21 3000 213
Supported Web Technologies: Amplehosting.co.za a Greycell.co.za company. © 2004
Moving Hosts? Client Support