.htaccess

Share With

I realize that experience https://www.jaguarpc.com/wp-content/uploads/2024/06/jag-cloud-vps-hosting-1.pngs know what a .htaccess file is and it’s importance. A large number of https://www.jaguarpc.com/wp-content/uploads/2024/06/jag-cloud-vps-hosting-1.pngs have no idea what you are taking about when you refer to a .htaccess file.

What is a .htaccess file? in laymen terms it is a simple text file named .htaccess. Notice that there is nothing before the [.]. You can create this file with a text editor. You can also create it through the CP if your hosted at Jag.

I might also note that every host does not allow individual users the privilege of using a .htaccess file on a shared server. Personally I would not use a host that did not allow the file.

So what is a .htaccess file good for? You can pass word protect files, block hot linking, implement 301 or 302 redirects and a lot more. In other words it gives you a lot of control over your web site.

Here are a few simple things that I use on my site.

AddHandler server-parsed .htm html #by default a Apache server will only parse shtml files. This line means that it will also parse htm and html documents. Why is this important? I use a lot of SSI (Server Side Includes) on my e-commerce site. I don’t want to rename 400 or so pages to shtml so the server parses the pages.

Hot link protection.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://secure.domian.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?IP Number(/)?.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|png|bmp|tif|zip)$ – [F,NC]

301 Redirects which I think are important.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

Redirect individual pages

Redirect permanent /old file.htm http://www.domaine.com/new file.htm

You can block IPs such as bad bots.

Bot blocking by IP

[Limit GET]order allow,deny
allow from all
deny from 123.456.789.0

[]for a larger list you might want to read in check Anthony Parsons forum.

If your site is a PHP site you can use mod_rewrite in the .htaccess file to produce SE Friendly page extensions.

You can do a lot more with a .htaccess file than what I have mentioned.

If your interested in learning more here are a few links that I hope you will find beneficial.

Comprehensive guide to .htaccess

Apache HTTP Server Version 1.3

A Google Search for .htaccess

A closing thought. Most FTP clients will not show a .htaccess file by default. Any file that begins with a (.) is like a hidden file on your PC.

Share With
Share On Facebook