.htaccess

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]
</IfModule>

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

<Files RELEASE_NOTES.txt>
order allow,deny
deny from all
</Files>


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.

<global>
...
<remote_addr_headers>
HTTP_X_REAL_IP
HTTP_X_FORWARDED_FOR
</remote_addr_headers>
...
</global>
Was this article helpful?
Thank you!