3

Is there any way to have the Magento home page be a static html page?

Under heavy load situations Magento (even with Varnish, APC, Fooman, block caching, etc) can be slow. However, I would like the home page to be as fast as possible. One way to do that is to just use a static HTML page.

Is this possible?

Alana Storm
  • 164,128
  • 91
  • 395
  • 599
BeaverProj
  • 2,205
  • 1
  • 17
  • 31

7 Answers7

4

Dropping in a simple mod_rewrite rule before the main index.php bootstrap capture should get you want you want

RewriteEngine on
RewriteRule ^$ static-html.html [L]
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
3

If you install magento under a directory like shop, nad have your static html in the root directory, then I am sure this will be vary easy.

Another option would be to set the default page for the root directory to be index.html via .htaccess, and then every request after that can go to the index.php of Magento.

I will try and come up with more ideas.

HTH

ShaunOReilly
  • 2,186
  • 22
  • 34
1

Under heavy load, you can use full page caching and you get this advantage (static page serving) not only on the front page, but all your CMS, Category and Product pages. Sites start failing to fall over when hit by Baidu, Google, Yahoo, Yandex and your customers all at once.

It's the major difference between Enterprise and Community Version and AITOC, Extendware, Tiny Brick, et. al. produce modules that implement it.

Yep, a static front page is probably doable, but the advantages will be short lived as your website picks up traffic.

Fiasco Labs
  • 6,457
  • 3
  • 32
  • 43
1

1st Solution:
Create index.html with your homepage contents
and in .htaccess add the following line at the end:

DirectoryIndex index.html

Not Sure about it's consequences though.

2nd Solution:
Create a CMS page with the contents with Layout = empty and assign the CMS page as Homepage from

System > Configuration > Web > Default Pages > CMS Homepage

This can be the ideal solution.

MagePsycho
  • 1,944
  • 2
  • 29
  • 60
0

if you want to use varnish (or any full page cache) you shoud be aware of the saying “There are only two hard things in Computer Science: cache invalidation and naming things”. the modules by phoenix and aoe_static go a long way to solving these problems but i don't think it's sensible to risk breaking a store. you should read the varnish docs and debug these modules in your store before proceeding. also i want to do some work in this area - check this post magento open source full page cache

Community
  • 1
  • 1
user1743741
  • 134
  • 1
  • 6
0

You have configured your server wrong if your home-page load times are slow when using Varnish. It sounds like your not ever actually hitting the cache.

Check your page headers for

X-Cache: HIT(xxx)

You can use CURL to check

curl -I http://www.mydomain.com

If after hitting the page more than once it still shows

X-Cache: MISS

Then you have not defined your VCLs properly.

Doing what you propose is not a good idea, for a number of reasons and it is replicating exactly what Varnish should be doing.

What is your definition of "heavy load"? What is your full server specification?

Ben Lessani
  • 2,141
  • 14
  • 16
  • Unforunately, the X-Cache headers we're turned on at the time. For some reason the home page cached data was corrupted or something because it wouldn't serve it up even though the rest of the site was working (albeit a bit slower than normal). Once we realized it wasn't load, but the cache issue we flushed that page from the cache and it came right back up. One concern is not catching the home page corrupted problem and people having problems getting to the home page. This wouldn't be a long term solution, but just up for a short time during a special case. – BeaverProj Mar 09 '12 at 23:15
  • Basically, once a year there is a big sale and they have a whole bunch of items that have only 1 inventory. The enable all the products at a specific time and loads of customers are waiting to buy these cheap items because they are their most loyal customers. Caches have to be cleared in order for this to happen and may not be fully warmed up (loads of new products). So its a tough situation. Best if the home page isn't slow if the rest of the store is. – BeaverProj Mar 09 '12 at 23:18
  • I think you are missing the point. The whole purpose of Varnish is to store a static version of the page. The VCLs you define control whether a page can be cached, and whether the data should be served from cache or backend. If your page load times are greater than 80ms when using Varnish - your VCLs are wrong. Rewriting to static html files is an extremely poor replication of what Varnish should be doing in the first place! Again, I ask, what is your definition of heavy load (visitors/bandwidth) and what is your full server specification. – Ben Lessani Mar 10 '12 at 20:58
  • Well, I was able to get debugging on and I'm clearly getting a lot of misses. I'm using the default VCL 3.0 from this package: http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html – BeaverProj Mar 14 '12 at 18:54
  • Well, even though Varnish 2 is outdated, I would suggest this method, its proven working on BIG stores we host (300k + daily unique visitors) http://www.sonassihosting.com/blog/magento-performance/magento-performance-optimization-with-varnish-cache-4/ – Ben Lessani Mar 15 '12 at 17:09
0

You would simply be curing the symptom, not the problem. Your site is slow because your hosting is inadequate or not optimised for Magento.

Using static HTML is not going to be practical when you have an e-commerce store that requires dynamic content (stock levels, cart content, account session etc.). Doing what you propose is certainly not the way to solve your issue, you will just create new ones in doing so.

Define "heavy load" and what you are using to host the site?

Ben Lessani
  • 2,141
  • 14
  • 16