.htaccess WordPress – Setari SEO

...cateva setari de optimizare pentru .htaccess

.htaccess WordPress – dupa instalarea standard WordPress, are un fisier .htaccess, doar cu setarile de baza daca sunt setate URL-urile SEO Friendly. Am sa va dau un exemplu de .htaccess, care poate fi utilizat pe orice platforma WordPress. In acest fisier este dezactivata optiunea ETag, este redirectionat domeniul de la .www, la non www, index.html sau index.php, va fi directionat catre radacina (numele de domeniu) si controlul asupra cache si mod expire. Aceste optiuni le folositi doar daca este necesar. Eu folosesc toate optiunile pentru a putea avea un .htaccess WordPress Profesional.

Explicatii mai detaliate gasiti si in filmul de mai jos:

.htaccess WordPress – Setari Profesionale

#Slash la sfarsit de URL
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.computerscom.ro/$1/ [L,R=301]
#Final Slash la sfarsit de URL
#Computerscom Optimizare
Header unset ETag
FileETag None
<ifmodule mod_expires.c>
<filesmatch "\.(jpg|gif|png|css|js)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</filesmatch>
</ifmodule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/ico "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
ExpiresByType application/x-javascript "access plus 1 months"
</IfModule>
ExpiresActive On
ExpiresByType image/gif A28800
ExpiresByType image/png A28800
ExpiresByType image/jpg A28800
ExpiresByType image/jpeg A28800
Header set Cache-Control "public"
ExpiresActive On
ExpiresDefault A18000
ExpiresByType image/gif A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/ico A2592000
Expiresbytype text/js A21600
Expiresbytype text/js "access plus 1 year"
ExpiresByType text/php "access plus 1 year"
ExpiresByType text/html "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
Header set Cache-Control "public"
ExpiresByType image/jpg "access plus 1 year"
Header set Cache-Control "public"
ExpiresByType image/jpeg "access plus 1 year"
Header set Cache-Control "public"
ExpiresByType image/png "access plus 1 year"
Header set Cache-Control "public"
ExpiresByType image/x-icon "access plus 1 month"
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
<IfModule mod_headers.c>
<FilesMatch "\.(bmp|css|flv|gif|ico|jpg|jpeg|js|pdf|png|svg|swf|tif|tiff)$">
Header set Last-Modified "Mon, 31 Aug 2010 00:00:00 GMT"
</FilesMatch>
</IfModule>
# Final Computerscom Optimizare
#Redirect de la Non-WWW, la WWW
RewriteCond %{HTTP_HOST} ^computerscom\.ro
RewriteRule (.*) http://www.computerscom.ro/$1 [R=301,L]
Options +FollowSymLinks
#Final Redirect de la Non-WWW, la WWW
#Redirectare URL vechi, la URL nou (URL-ul vechi nu trebuie sa contina http://www.computersom.ro
redirect 301 /update-php-5-1-6-5-2update-php-on-centos/ http://www.computerscom.ro/update-php-on-centos-php-5-1-6-to-5-2/
#Redirectare URL

Articol scris de: SEO Romania in data de:

.htaccess WordPress – Setari SEO

.htaccess WordPress – dupa instalarea standard WordPress, are un fisier .htaccess, doar cu setarile de baza daca sunt setate URL-urile SEO Friendly. Am sa va dau un exemplu de .htaccess, care poate fi utilizat pe orice platforma WordPress. In acest fisier este dezactivata optiunea ETag, este redirectionat domeniul de la .www, la non www, index.html […]


Comentarii.

  1. SEO Expert

    mai 24, 2011 (19:01)

    Inainte de aplicarea acestor coduri in .htaccess, ar trebui sa faceti un test cu Page Speed, apoi aplicati aceste coduri si testati iarasi, veti vedea ce crestere la procentul de optimizare aveti.

  2. Eduard

    mai 26, 2011 (12:38)

    Am dat de o problema, am adaugat aceste coduri in .htacces si acum imi spune (Google Chrome) ca nu poate incarca pagina, link-urile ce tineau de computerscom au fost modificate cu cele ale site-ului meu.

  3. SEO Expert

    mai 26, 2011 (14:17)

    Codurile respective sunt valabile la majoritatea serverelor, foarte rar nu le accepta un server, doar daca este slab. Important ar fi sa ma contactati prin Yahoo Messenger si sa facem impreuna. Este posibil sa fie o eroare insa se rezolva fara probleme. Poate nu sunt necesare toate codurile respective.

    ID Yadoo: computerscomseo

  4. Salut spuneti-mi va rog cum este mai bine sa adaug acel cod ,uita-ti .htaacesul meu ….
    ##
    # @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
    # @package Joomla
    # @copyright Copyright (C) 2005 – 2010 Open Source Matters. All rights reserved.
    # @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
    # Joomla! is Free Software
    ##

    #####################################################
    # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
    #
    # The line just below this section: ‘Options +FollowSymLinks’ may cause problems
    # with some server configurations. It is required for use of mod_rewrite, but may already
    # be set by your server administrator in a way that dissallows changing it in
    # your .htaccess file. If using it causes your server to error out, comment it out (add # to
    # beginning of line), reload your site in your browser and test your sef url’s. If they work,
    # it has been set by your server administrator and you do not need it set here.
    #
    #####################################################

    ## Can be commented out if causes errors, see notes above.
    Options +FollowSymLinks

    #
    # mod_rewrite in use

    RewriteEngine On

    ########## Begin – Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    ## Deny access to extension xml files (uncomment out to activate)
    #
    #Order allow,deny
    #Deny from all
    #Satisfy all
    #
    ## End of deny access to extension xml files
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]
    # Block out any script that includes a tag in URL
    RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End – Rewrite rules to block out some common exploits

    # Uncomment following line if your webserver’s URL
    # is not directly related to physical file paths.
    # Update Your Joomla! Directory (just / for root)

    # RewriteBase /

    ########## Begin – Joomla! core SEF Section
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/index.php
    RewriteCond %{REQUEST_URI} (/|.php|.html|.htm|.feed|.pdf|.raw|/[^.]*)$ [NC]
    RewriteRule (.*) index.php
    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    #

    ########## End – Joomla! core SEF Section

    Header unset ETag
    Header unset Last-Modified

    FileETag None

    Header unset Cache-control
    Header set Expires „access plus 1 month”

    ### activate mod_expires
    ExpiresActive On
    ### Expire .gif’s 1 month from when they’re accessed
    ExpiresByType image/gif A2592000
    ### Expire everything else 1 day from when it’s last modified
    ### (this uses the Alternative syntax)
    ExpiresDefault „modification plus 1 day”
    ### Apply a Cache-Control header to index.html

    Header append Cache-Control „public, must-revalidate”

    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    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.*

    ExpiresActive on
    ExpiresByType image/gif „access plus 1 months”
    ExpiresByType image/jpeg „access plus 1 months”
    ExpiresByType image/png „access plus 1 months”
    ExpiresByType text/css „access plus 1 months”
    ExpiresByType application/x-javascript „access plus 1 months”

    Va rog sa-l modificatii corespunzator impreuna cu codurile Dvs…pentru o viteza si indexare mai buna

    Multumesc

Parerea Dvs.?.

 © 2008-2016  Computerscom SEO Romania