Enable Gzip on Share Hosting in Right Way – Unix Like

WordPress No Comments

The tips for Gzip enabling on sharing hosts installed Unix like OS. I know many resources on Google.com can help you already. So this is not an full guide for enable Gzip. Although I have listed a dozen of tips at the end of this post. Read my story to understand what I wanna share with you. That’s an specific medicine for the guys who is dropping in the same situation I met.

Today, I did the optimization for the blog as usual after the blog(buy STO credit) has been set up. The blog is hosted by Godaddy Sharing Host(Specially, Linux economy plan. Why? As it’s cheap prices and decent CS. If you have any suggestion to me, I appreciate!). After the bog got a nice score with YSlow, I noticed that the title rewrite has been all death. I have used the famous WordPress plugin titled All in One SEO by Michael Torbert. Sincerely, I am so lazy so that I didn’t read the sources code ever. I have to read the code to understand how it works. aha..It uses the function ob_start() to get call callback function in the class to rewrite the original title. That’s where the collision comes from. I have used the ob_start(“gz_handler”) to enable Gzip for buystocredit.com. Read the PHP manual for function ob_end_flush() to know the collision well if you want to know more.
So, the issue I met when I enabled Gzip was clear.

What is the tip to fix?

  • Web Server: Apache 1.3.* with PHP5 on Linux Share Hosting
  • Blog Software: WordPress
  • Plugin Enabled: All in one SEO pack
  • Gzip Enabled Method: call ob_start(“gz_handler”) at the beginning of each page
  • Result: All in one SEO pack title rewrite disables
  • Solution: Use zlib.output_compression to instead of ob_gzhandler()
    1. Remove the ob_start(“ob_gzhandler”) from everywhere in your codes
    2. Modify the php5.ini/php.ini at the web root as following:zlib.output_buffering = On
      ;zlib.output_handler = ob_gzhandler //comment it out, as it cannot be used with the zlib.ouput_compression is on
      zlib.output_compression = On

There are many way to enabled Gzip as following.

Apache 2.0.x – if the mod_felate enabled by your host provider.
Enable Gzip via Mod_deflate
Apache 1.3.x – if the mod_gzip installed and enabled by your host provider
Official Mod_Gzip Manual or Fast Usage Tips
PHP 4.0.4 or higher Ob_start(“ob_gzhandler”)
Fast Effective PHP Gzip Compression
PHP zlib.output_compression
The method in my post!
Other resouces:
Gzip with .htaccess and PHP
Better Explained? Interesting domain

How to add nofollow – Simplest Way

WordPress No Comments

In order to add the nofollow into the result of wp_get_archives(), you may need a few PHP skills. But it’s simple, means can be understand easily.
The main elements are:

  1. Use the echo feature of the built-in function wp_get_archives
  2. use the PHP function str_replace to add the nofollow tag into the return built-in function.


<?php
//step1, built-in function usage; pay attention to the echo=0
$month_archives=wp_get_archives('type=monthly&echo=0');
//step2 replace the <a with <a rel="nofollow"
$month_archives=str_replace('>a','>a rel="nofollow"',$month_archives);
echo $month_archives;
?>

Remove Genrator Tags

WordPress No Comments

As one of the security tips – we should remove the generator information from the header if we are using wordpress for the blog.
It’s simple to do, just remove the following line from the header.php in your theme.

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->

If you are seeking tips for wordpress security. Then the following are bonus if your blog is being run under APACHE.
1: Keep your wp-admin folder safely: just create an .htaccess file.

AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName “Access Control”
AuthType Basic
order deny,allow
deny from all
# whitelist home IP address
allow from 66.234.165.99
allow from 67.148.115.25
allow from 191.58.54.6*

2: Don’t expose your plugin:) Just add the blank file into the root of your wordpress plugin file.

@ 2009-2012 - GGIN.Com
Entries RSS Comments RSS Log in