800x6001024x768Auto Width
Главная
Forum
WordPress
Joomla
Drupal
Template Box
Php-Fusion
BoxedArt Template
DLE
TM
vBulletin
Scripts
Photoshop & Corel
Icons
Учебники
Шрифты
Templates
Programms
Articles
SEO
MP3
Ссылки
Контакты
Rapidshare Search
YouTube Download
Online Photoshop
Nod32 fresh keys
iPhone,iPod soft
Web Tools
Sitemap
Partners

Free Full Downloads

Auto Submitter

 

Статистика
Рейтинг@Mail.ru

Rambler's Top100
TOP 13 .htaccess Essential Tricks For Blog/Website Печать E-mail
Автор Administrator   
27.06.2009 г.
htaccess-tricks.jpg

Data Compression

Use this code to compress data at web server. Data compression can minimize resources and bandwidth you consume while your website browsing.

# data compressionAddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript

GZip Data Compression

Following is GZIP Compression code. More effective. You can specify which files to compress.

# gzip compression<IfModule mod_gzip.c>    mod_gzip_on       Yes    mod_gzip_dechunk  Yes    mod_gzip_item_include file      \.(html?|txt|css|js|php|pl|jpg|png|gif)$    mod_gzip_item_include handler   ^cgi-script$    mod_gzip_item_include mime      ^text/.*    mod_gzip_item_include mime      ^application/x-javascript.*    mod_gzip_item_exclude mime      ^image/.*    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*</IfModule>

Preserve Bandwidth

Preserve bandwidth using this method. This is also a compression method.

# preserve bandwidth<ifmodule mod_php4.c> php_value zlib.output_compression 16386</ifmodule>

Cache Control

Cache is very very useful. By using following code in .htaccess you can enable cache of your files. When enabling cache you will see significant increase in website load time. You will be really amazed to see heavy pages and images loading very fast.

# Begin Cache Control<IfModule mod_expires.c>ExpiresActive OnExpiresByType application/x-javascript A2592000ExpiresByType text/css A2592000ExpiresByType image/gif A604800ExpiresByType image/png A604800ExpiresByType image/jpeg A604800</IfModule>

Secure .htaccess file

Deny .htaccess file to all intruders. You can specify more files which you want to protect by seperating file names by | sign. .htaccess file can have potential information which must be secured from all outside intruders.

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

Secure Directories

By default your web server’s indexes are on. That means the directory with no index file in it will display all the files in it. Do you want the files in your wp-admin, wp-includes, images, uploads, themes, plugins folders to be seen? It is really not a good idea to show your online folder files. By using following code you will enable protection for all online directories with no index file and will not display files in them.

# No directory listing across domainOptions -Indexes

Secure Hidden Files at Server

Hidden files can be server configuration files, log files and other server reserved files which should be protected from hackers as well.

# Disallow hidden filesRedirectMatch 403 /\..*$

Stop Hotlinking

Some webmasters will just copy the path of images and other media from your website and use that in their own website to display your content consuming your bandwidth. This method is called as hotlinking. Protect hotlinking by using the following code. sorry.gif in the following example is the alternative file which will be displayed when someone will try and steal your content.

# stop hotlinking and serve alternate contentRewriteEngine OnRewriteCond %{HTTP_REFERER} !^$RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourservernamehere.com/RewriteRule \.(gif|jpg)$ http://www.yourservernamehere.com/sorry.gif [R,L]

Secure Contact Forms

Secure your contact form from bots and automated softwares which will email you spam. Change ‘contact.php’ page name to your contact page name.

# secure contact formsRewriteCond %{HTTP_REFERER} !^http://www.yourservernamehere.com/.*$ [NC]RewriteCond %{REQUEST_POST} .*contact.php$RewriteRule .* - [F]

Redirect Error Pages

Have you ever encountered 500 error. Internal Server error. That’s really ugly black and while page. I would suggest you to create your own custom error pages and use them wisely to make users stay at your website even some error occurs. Use the following code to redirect the users to your custom error pages in case some error occurs.

<IfModule mod_rewrite.c>RewriteEngine OnErrorDocument 206 http://www.yourservernamehere.com/maintenance-mode.htmlErrorDocument 400 http://www.yourservernamehere.com/maintenance-mode.htmlErrorDocument 408 http://www.yourservernamehere.com/maintenance-mode.htmlErrorDocument 500 http://www.yourservernamehere.com/maintenance-mode.htmlErrorDocument 404 http://www.yourservernamehere.com/404.html</IfModule>

Disable ETags

Disabling Etags will also increase website speed a bit. Removing ETags is a very safe option.

# disable etagsFileETag none

Enable Simple Mod Rewrite

This is not a performance tip. This is how you enable rewriting at your server. I will write a guide about Mod Rewriting in next .htaccess post.

# enable basic rewritingRewriteEngine on

Instruct Browser to Download Multimedia Files - Force Download

If you want to tell the browser to download certain file types then use the following code.

# instruct browser to download multimedia filesAddType application/octet-stream .aviAddType application/octet-stream .mpgAddType application/octet-stream .wmvAddType application/octet-stream .mp3

In the end let m give you two beautiful resources about .htaccess.

Рекомендуйте этот пост своим знакомым...


Добавить в любимые (59) | Просмотров: 1055

Ваш коментарий будет первым
RSS комментарии

Только зарегистрированные пользователи могут оставлять коментарии.
Пожалуйста зарегистрируйтесь или войдите в ваш аккаунт.

 

Добавить комментарий


Защитный код
Обновить

« Пред.   След. »
FrenchGermanItalianPortugueseRussianSpanish
Eset Nod32 keys Ключи для NOD32
Меню пользователя
All4webNews Subscribe to All 4web news by Email
Топ вирусов
Последние коментарии
Создай открытку за 5 минут-Por...
Troubleshot?
15/08/10 18:55 Ещё...
Написал Admin

Joomla Super Pack 2009 DVD
:( :( :( :( :( :( :( :(
14/08/10 16:02 Ещё...
Написал svs

Создай открытку за 5 минут-Por...
Problem with activation
Hi there, I dont know if I am writing in a proper board but ...
06/08/10 23:35 Ещё...
Написал Sylvia

JS Library 1.0 RUS - 1000 уник...
The file could not be found. Please check the download link.
16/07/10 10:44 Ещё...
Написал error

Жукладочник v3.0.0.90 PRO Crac...
Кряк не рабочий, выкидывает при работе в течении минуты
14/07/10 09:00 Ещё...
Написал Саша

Ad Muncher 4.8 Build 31318 Fin...
Отличная программа!!!
13/06/10 07:30 Ещё...
Написал Кантик

Ad Muncher 4.8 Build 31318 Fin...
Прога шикарная!!!!Скачал,крякнул и живи в интернете,и не нер...
13/06/10 07:29 Ещё...
Написал Василий

Десятка лучших генераторов шаб...
ОНЛАЙН-ХЕРНЯ,лудше десктопные проги такого-же плана описали
05/05/10 12:25 Ещё...
Написал dt

49 future PNG icons
Рабочая ссылка.
20/04/10 19:36 Ещё...
Написал Admin

49 future PNG icons
И наХРЕН так делать , объясните???? :x :x :x
20/04/10 14:34 Ещё...
Написал Александр Чудо


Украинская Баннерная Сеть