Magento 1.x comes with a terrible .htaccess file out of the box,  which slows the sites performance down significantly and sets defaults for variables that limit scalability.

Replace the full contents of Magento's .htaccess with this:

php_value memory_limit 256M
php_value always_populate_raw_post_data -1

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

    RewriteRule .* index.php [L]

#If you have charset-problems, you could try uncommenting the following line
#AddDefaultCharset off

    order allow,deny
    deny from all

Correct IP Addresses in logs

Because Magento is placed behind a reverse proxy in our setup, you will need to add the remote_addr_headers section to your config file in app/etc/local.xml to get correct visitor IP addresses throughout Magento.


Did this answer your question?