• Remove Trailing Slash From Magento URLs – SEO Duplicate Content Issue

    Because of SEO reasons, a common problem that Magento has is that it indexes two URLs of the same page which causes issues with duplicate content when it comes to Google crawling.
    For example it will index both of these URLs.

    Ideally, we want Magento adding trailing slashes to the end of the URLs and then redirect it to the page without the trailing slash, and here’s how.

    Let's get started

    To start with we need to edit the getURL() method to stop it generating URLs with trailing slashes, so copy the following file from:

    Now open Abstract.php and find the following line of code:

    return $this->_getUrlModel()->getUrl($route, $params);

    Replace that line with the following:

    $return_url = $this->_getUrlModel()->getUrl($route, $params);

    if ($return_url != $this->getBaseUrl() && substr($return_url, -1) == '/' && !Mage::getSingleton('admin/session')->isLoggedIn()):

    return substr($return_url, 0, -1);


    return $return_url;


    Now copy the file app/code/core/Mage/Core/Model/Url.php
    Once you’ve done that open it and find the following code:

    if ($noSid !== true) {



    Change ($noSid !== true) to ($noSid == false)

    Edit your .HTACCESS file

    Find the following line of code:

    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    Add the following immediately underneath it:
    RewriteCond %{request_method} ^GET$
    RewriteCond %{REQUEST_URI} !^/downloader.*$
    RewriteCond %{REQUEST_URI} ^(.+)/$
    RewriteRule ^(.+)$ %1 [L,R=301]

  • Magento - How to fix Php 5.6 deprecated messages

    Magento officially doesn't support Php 5.6. But you know, the latest version of Php (right now 5.6.1) comes with a lots of new features and optimizations, which could be handy.

    But those nasty deprecated messages “Deprecated functionality: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated” fills Magento’s logs, right?

    Temporarily, we simply just have to override some core files of Magento (well, they are core Zend Framework files).

    Here are the steps to follow:
    1. Create the following folders:

    2. Copy the following files from /lib/Zend/ to /app/code/local/Zend/:

    3. Open the files from /app/code/local/Zend/ in a text editor and search for “internal_encoding” and replace them with “default_charset”.

    Before doing this, make sure that the “internal_encoding” string is a parameter of an iconv related function. Don’t replace “mb_internal_encoding”, “$internal_encoding” or any other non iconv related stuff, because code will be broke.

    This solution is for Magento 1.8, but it should be very similar for 1.9 as well. If you are not sure, just search in all files for “internal_encoding” and do the three steps above for the needed files.

    Hope this would be help!

  • Make faster Magento ecommerce: Performance & Hosting Tips for Better Conversion

    Enable Cache Management in the Magento Admin Panel

    Enable Cache Management in the Magento Admin Panel

    First thing you should always do before going live — enable cache management! This is good way to improve Magento performance. Go to System > Cache Management and enable each cache type. Just make sure when you update your system to flush the cache so you can see your changes.

    Enable JavaScript and CSS Combining in the Magento Admin Panel

    Enable JavaScript and CSS Combining

    Another easy configuration setting located in System > Configuration under Advanced > Developer. Merge your JavaScript and CSS files to save on initial loading time when the customer first visits your site. Without this your customers will have to download each JS/CSS file one-by-one. Reduce the number of HTTP requests dramatically by using this option. In Avalanche, we cut down our JS requests to 2 files on the homepage and 1 CSS file.

    Install Fooman Speedster via Magento Connect (Free)

    Install Fooman Speedster via Magento Connect

    This free extension from Fooman will minify your JavaScript and CSS files using the PHP minify library. It also compresses your code and provides automatic versioning. To install, click here to get your extension key for Fooman Speedster. You’ll then need to log in to your Magento admin panel. Go to System > Magento Connect > Magento Connect Manager. Add the extension key and install the extension. You may have to update your folder write permissions via SSH in your Magento install directory. Refer to thisMagento Connect permissions guide for more information.

    After installing, your files should be minified instantly. Go ahead and check your combined scripts to see Fooman Speedster in action.

    Install HTML Minification by Jemoon via Magento Connect (Free)

    Install HTML Minification by Jemoon via Magento Connect

    Although this extension is still in beta, I haven’t experienced any issues with it. HTML Minification by Jemoon is straightforward and easy to set up. Get your extension key for HTML Minification here. Follow the same instructions as Fooman Speedster. Make sure you allow beta extensions in your settings tab. Your HTML files should automatically be minified! It’s that easy.

    Optimize Your .htaccess File for Max Performance

    There’s a lot of optimization techniques you can use to dramatically increase Magento performance via your .htaccess configuration. Here’s a comprehensive list:

    Enable Gzip Compression

    # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
    SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s,?\s(gzip|deflate)?|X{4,13}|~{4,13}|-{4,13})$
    RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
    FilterDeclare   COMPRESS
    FilterProvider  COMPRESS  DEFLATE resp=Content-Type /text/(html|css|javascript|plain|x(ml|-component))/
    FilterProvider  COMPRESS  DEFLATE resp=Content-Type /application/(javascript|json|xml|x-javascript)/
    FilterChain     COMPRESS
    FilterProtocol  COMPRESS  change=yes;byteranges=no


    Use Expires Headers for Better Cache Control

    “Entity tags (ETags) are a mechanism web servers and the browser use to determine whether a component in the browser’s cache matches one on the origin server. Since ETags are typically constructed using attributes that make them unique to a specific server hosting a site, the tags will not match when a browser gets the original component from one server and later tries to validate that component on a different server.”

     ExpiresActive on
    # Perhaps better to whitelist expires rules? Perhaps.
    ExpiresDefault                          "access plus 1 month"
    # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
    ExpiresByType text/cache-manifest       "access plus 0 seconds"
    # Your document html
    ExpiresByType text/html                 "access plus 0 seconds"
    # Data
    ExpiresByType text/xml                  "access plus 0 seconds"
    ExpiresByType application/xml           "access plus 0 seconds"
    ExpiresByType application/json          "access plus 0 seconds"
    # RSS feed
    ExpiresByType application/rss+xml       "access plus 1 hour"
    # Favicon (cannot be renamed)
    ExpiresByType image/x-icon              "access plus 1 week"
    # Media: images, video, audio
    ExpiresByType image/gif                 "access plus 1 month"
    ExpiresByType image/png                 "access plus 1 month"
    ExpiresByType image/jpg                 "access plus 1 month"
    ExpiresByType image/jpeg                "access plus 1 month"
    ExpiresByType video/ogg                 "access plus 1 month"
    ExpiresByType audio/ogg                 "access plus 1 month"
    ExpiresByType video/mp4                 "access plus 1 month"
    ExpiresByType video/webm                "access plus 1 month"
    # HTC files  (css3pie)
    ExpiresByType text/x-component          "access plus 1 month"
    # Webfonts
    ExpiresByType font/truetype             "access plus 1 month"
    ExpiresByType font/opentype             "access plus 1 month"
    ExpiresByType application/x-font-woff   "access plus 1 month"
    ExpiresByType image/svg+xml             "access plus 1 month"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    # CSS and JavaScript
    ExpiresByType text/css                  "access plus 1 year"
    ExpiresByType application/javascript    "access plus 1 year"
    ExpiresByType text/javascript           "access plus 1 year"
    Header append Cache-Control "public"
    // ]]>

    Remove Unncessary JavaScript Files in Your Magento Layout XML Files

    There’s a lot of JavaScript bloat in Magento. You can safely remove certain files and improve performance. Here’s a sample from Avalanche’s page.xml layout file:

     I commented out all of the Scriptaculous code and translate.js. Menu.js was also removed for custom jQuery code. 

    Install APC, Eaccelerator or Xcache on Your Server

    This one is more difficult — you’ll need SSH access to install one of these on your server. These cache systems make PHP more responsive by caching your PHP code, stopping the interpreter from recompiling code upon every request. I’ve used APC in the past and have had mixed results using it with Magento, but try it out and see if your page performance increases.

    If you’re wondering which one to use, check out APC vs. Eaccelerator vs. Xcache on StackOverflow.

    If you want to install APC on an Ubuntu server, this is the approach I use.

    Move jQuery & Custom JavaScript Code to the Footer

    If you’re using jQuery (hopefully you are) and custom code, you’ll definitely want to include those files at the bottom just above your ending body tag. This way your website will render on the screen faster and not have to wait for these additional JS files to load. Learn more about JS footer code here.

    Use Amazon S3 for Image Hosting & Install OnePica_ImageCDN via Magento Connect (Free)

    Amazon S3 is a cost-efficient way to serve product photos in your Magento store. It’s very inexpensive and quick to set up. Luckily there’s a free Magento extension that lets you hook up your Amazon S3 bucket. Using OnePica_ImageCDN makes it easy to set up your own CDN server for images using Amazon S3. Why should you use Amazon S3/CDN?

    Design CSS Sprites to Reduce HTTP Requests

    Here’s another standard front-end optimization: Group your CSS background images into sprites. The browser downloads the images used in your CSS when your CSS file is loaded, slowing down render speed. A sprite can include as many images as you want in a single file. Typically I group rating stars and button states into their own unique sprites instead of having separate images for each state or rating, e.g. button_hover.gif, button_active.gif or rating_1.gif, rating_2.gif. However, it gets kinda tricky. If you have repeat-x or repeat-y backgrounds you can’t place them together in one sprite. When you build sprites you’re using overflow: hidden in your CSS and cutting off part of the sprite to only show one piece of the sprite. To learn more about CSS sprites, click here.

    Testing Your Magento Theme Speed

    Testing Your Magento Theme Speed

    If you want to see how fast your magento theme is performing in the front-end, use Developer Tools in Chrome or Firebug for Firefox. Install the YSlow extension/add-on.

    Hopefully our tips is helpful! If you have any questions don’t hesitate to contact us

  • How to create and use a robots.txt file

    Web site owners use the /robots.txt file to give instructions about their site to web robots; this is called The Robots Exclusion Protocol

    Below are instructions for creating and using a robots.txt file for your website, so that search engines index the content management of your website

    robots.txt is a structured text file, when the spider (bot, crawler) of the SE (search engines) to the site to collect data on the robots.txt file would be to see the instructions in this file.

    robots.txt can assign each of the different types of bot SE can vary in each area of the website or the website or not?

    Some of the SE bots: Googlebot (Google), Googlebot-Image (Google), Yandex (Russian SE)​​, Bingbot (Bing) / Yahoo Slurp (Yahoo) ...

    The common syntax of a robots.txt file

    User-agent: objects bot is accepted

    Disallow / Allow: URL you want to block / allow

    *: Represents all

    For example: User-agent: * (That means accepting all types of bots.)

    Lock the entire site

    Disallow: /

    Block 1 folder and everything in it

    Disallow: /wp-admin/


    Block 1 Page

    Disallow: /private_file.html


    Removing pictures from Google Images 1

    User-agent: Googlebot-Image

    Disallow: /images/sexy.jpg


    Put all the pictures from Google Images:

    User-agent: Googlebot-Image

    Disallow: /


    Block any image file, for example gif

    User-agent: Googlebot

    Disallow: /*.gif$


    Things to avoid in the robots.txt file

    - Distinguish case sensitive.

    - No written opinion, the lack of spaces.

    - Do not insert any character other than the command syntax.

    - Each statement should be written on one line.

    How to create a robots.txt file and location

    - Use notepad or any other program that created the file, then rename the file robots.txt.

    - Put in the root directory of the website.

  • Magento: How to update custom attributes product values by script

    This should give you an idea for how to run a script to perform a mass update on your products.

     * Script to update custom attributes product values
    foreach($_productCollection as $_product)  {
        $product = Mage::getModel('catalog/product')->load($_product->getId());   
                    'custom_attribute_1' = 'VALUE_OF_ATTRIBUTE1',
                    'custom_attribute_2 '= 'VALUE_OF_ATTRIBUTE2',); 
        Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->getId()), $data, $storeId); 
  • Import database using command line (on Windows)

    1. Open command line windows (C:\windows\system\cmd.exe)

    2. type: mysql -u [{username}] -p [{password}]
    Ex: mysql -u [root] -p []

    3. type: cd {my_sql_path}\bin
    cd C:\xampp\mysql\bin

    4. type: use {database name}
    use demo_db

    5. type: \. {sql_file_path}
    Ex: \. C:\demo.sql

  • Analyze xdebug memory profiling for PHP

    Step 1:      Install XDebug on Wamp

    1. Download the latest release of xdebug for PHP version you are using.

    2. Copy xdebug dll file into php’s extension directory, in my case, as I use wamp, it is C:\wamp\bin\php\php5.4.16\ext

    3. Now we need to configure xdebug so that it get recognized by PHP, so open php.ini. For CLI it will be located at  C:\wamp\bin\php\php5.4.16\php.ini. and Apache it will be located at C:\wamp\bin\php\php5.4.16\php.ini. You need to modify both above files Continue reading

  • Enable Template Path Hints for Frontend & Admin Panel in Magento

    In magento, the html on any page comes from many different phtml files. So if you want to make a change in any page, you need to first know from where that html code is generated. To know this, you need to enable template path hints from magento.


    Continue reading

  • Speed Optimize Magento for Developer Machine Windows

    Summary:  optimize Magento for a local Windows developer machine

    We've optimized Magento for a local Windows machine and reached speeds increasements of 400% (4 times) till 3000~1500% (15 to 30 times). The screen below shows the speed measurements.

    After optimization the average load of a Magento page is 1.0 seconds till 1.53 seconds. Below 12 steps have been detailed out to optimize your own Magento.

    Wampserver + magento speed optimization on windows


    1.     Added APC cache and optimized for Magento.
    2.     Disabled Xdebug extension.
    3.     Changed memory limit of PHP to 512MB
    4.     Unloaded Apache extensions not used, also unload PHP Extensions.
    5.     Disabled firewall and antivirus.
    6.     Tweak thread and memory settings of Apache.
    7.     Enable gzip compression with .htaccess
    8.     Moved .htaccess to vhost file, and Allow Options None in documentroot.
    9.     Enabled in Magento backend (System > Configuration > Advanced > Developers > Css merge)
    10.  Enabled Javascript compression
    11.  Enable Magento compiler (will compile all files to /includes/src ~ System > Tools > Compiler)
    12.  Use IPv4 only

    Continue reading

  • Magento xdebug with Netbeans


    Magento xdebug with Netbeans 7.3.1 and wampserver.

    Taking the pain to have a debugger working is worth the effort. I will take you through setting up debugging with xDebugger on Netbeans and windows and wampserver in 14 steps. This how to debug with Magento using Netbeans and xdebugger tutorial is written for Windows, but in general it can be used for any operating system such as Linux or Mac OS.

    1. Install wampserver (latest preferable 32 bit). Wampserver already includes the xdebugger extension.
    2. Install Netbeans. Netbeans works well with local or remote debugging.
    3. Configure xdebug to work
    4. My php.ini xdebug configuration looks like

    Continue reading

Items 1 to 10 of 14 total

per page
  1. 1
  2. 2
My Cart