Eksperci IT - specjalizujący się w optymalizowaniu działania serwerów: WebSphere & WebLogic

.Htaccess file and wordpress, joomla or any other cms

Aktualności
.Htaccess file and wordpress, joomla or any other cms

.Htaccess file and wordpress, joomla or any other cms

By There are no tags 0 comments

In many cases, even though the purchase hosting services do not have access to the Apache configuration file or httpd.conf so it is and it's output. You can configure many server parameters in your .htaccess file and will this article.

First, the .htaccess file located in the root directory of the domain, and if you have multiple domains on your server it Similarly, and these files we can change/configure. Remember that the records contained in the file .htaccess there are for a given directory and all subdirectories in it. If for example. in the other place .htaccess file is included in the directive will be applied to this subdirectory and its subdirectories below, and this only to the parent directory in which it was given. In such way you can configure different parameters in each of the directories on the server.

.Htaccess file is a plain ASCII text file, and you can create it manually using the Windows Notepad.

Create a "new" file (Ctr + N) > we needed commands remembering mark enter after each of them > save > "Save as" file name: ".htaccess" > in Save as type: choose "all files" > and click Save

Then upload the file to our Web server to the root of your domain and we give him permission 644

CHMOD 644 .htaccess
  1. The General parameters of the .htaccess file
# ServerAdmin:
Setenv SERVER_ADMIN [email protected]

# DirectoryIndex:
DirectoryIndex URindex.html URindex.htm URindex.php/index.php

# htaccess file protection
<files .htaccess=""></files>
	order allow, deny
	Deny from all
 

# disable the server signature
Serversignature Off

# limit file upload example. 10 MB
LimitRequestBody 10,240,000

# Disable directory browsing from a Web browser
Options All-Indexes
  1. The extension of all files
AddDefaultCharset UTF-8
DefaultType text/html

AddType text/css.
AddType text/html; Charset = UTF-8 '.
AddType text/html; Charset = UTF-8 '. URhtml.gz
AddType application/xhtml + xml; Charset = UTF-8 ' xhtml.
AddType application/xhtml + xml; Charset = UTF-8 '. URxhtml.gz
AddType application/rdf + xml; Charset = UTF-8 ' install.RDF
AddType text/plain. sh. bsh bash. awk. nawk. gawk. csh. var. c. h. asc md5. sha1 sha.

# JavaScript (JS) markup
AddType application/javascript .js
AddType application/x-javascript .js
AddType text/javascript .js
AddType application/json json.

# Audio
AddType audio/ogg, oga ogg
AddType audio/mp4 m4a f4a f4b

# Video
AddType video/ogg, ogv
AddType video/mp4 mp4 m4v, f4v f4p
AddType video/webm webm
AddType video/x-flv flv
  1. Compression
<IfModule mod_deflate.c=""></IfModule>
    AddOutputFilterByType DEFLATE application/xhtml + xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/pdf
 
  1. Browser-cache
# A2592000 = 30 days
<IfModule mod_expires.c=""></IfModule>
    Header set cache-control: public
    ExpiresActive On

    ExpiresByType image/gif A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/png A2592000
    ExpiresByType text/css A2592000
    ExpiresByType application/x-font-ttf A2592000
    Opentype font/A2592000 ExpiresByType
    ExpiresByType application/javascript A2592000
    ExpiresByType text/javascript A2592000
 
  1. Configuration of WordPress
# URwpconfig.php file protection
<files wp-config.php=""></files>
	order allow, deny
	Deny from all
 

# BEGIN WordPress
<IfModule mod_rewrite.c=""></IfModule>
    RewriteEngine On
    RewriteBase//
    RewriteRule ^ index.php $- [L]
    RewriteCond% {REQUEST_FILENAME}!-f
    RewriteCond% {REQUEST_FILENAME}!-d
 
# END WordPress

The effect? Website on Google PageSpeed Insights of the values of 63/100 to 86/100

© 2016 FlexNet.pl / Wszelkie prawa zastrzeżone