.htaccess
This explains what a .htaccess file is and how it can benefit you.
What is an .htaccess file?
An htaccess file is a simple text file that you create with notepad or any text program that allows you to automatically carry out some important tasks like password protecting directories, preventing hotlinking, custom error pages, banning certain visitors, redirecting certain pages to go to other pages, and some other functions. Htaccess files affect the directory they are placed in and all sub-directories so if you plan on using it alot you will probably have a few htaccess files in different directories. Htaccess files need to be uploaded in ascii format, not binary format, and you should also chmod them so that they can't be read by a browser.An important thing for beginners is to note the file name. The file name is always ".htaccess" - the file extension is "htaccess" and there is no file name. Some beginners have trouble creating custom file extensions in Windows so the best way to create the file is to upload a text file to your server and then simply rename it to ".htaccess".
Deny and allow IP addresses or domains
If a visitor tries to access a page with a banned IP they will see a 403 Page (Forbidden Access Error). Banning IPs is easy and is one of the first tools beginning webmasters use to regulate their unwanted traffic but banning IPs has limited value because most web users' IPs change. For example, many web users try to kill their comment spam and referral spam by banning IPs but this is useless. You could ban a whole block of IPs but the broader you make the block the higher the risk of banning legitimate traffic..htaccess file
This will allow you to deny access from a specific IP.|
<limit get post> order allow,deny deny from 67.42.147.237 allow from all </limit> | ||
This will allow you to deny all visitors except a specific IP.
|
<limit get post> order deny,allow deny from all allow from 67.40. </limit> | ||
This will allow you to deny visitors from a particular domain.
|
<limit get post> order allow,deny deny from microsoft.com allow from all </limit> | ||
Page redirects
This is used to redirect one page to another. There are 3 parts to the code and they should all be on one line and seperated by a space. First is the "Redirect" statement. Second is the location of the file you want redirected relative to the "root" directory of your site. If the file is in www.yoursite/directory/index.php would be "/directory/index.php". Third is the full URL of the file you want to redirect to..htaccess file
This will redirect one file to another file.|
Redirect directory/oldfile.php http://www.yoursite.com/newfile.php | ||
This will redirect one whole directory to another.
|
Redirect /olddirectory http://www.yoursite.com/newdirectory/
| ||
Bookmark this page: |

