Alternative PHP Cache, APC, on GoDaddy Hosting

As I said earlier, Godaddy is implementing APC ( a great cache functionality) on its shared hosting plans. In a recent contact I had with them, it looks like the launch day is tomorrow.
Godaddy.comTill now, Godaddy disabled (by default) this extension for clients using actually Zend and Ioncube; good choice; as these 3 extensions represent an incompatibility risk.

If you want to benefit from the “awaited” great performance boosts with APC, you need to disable Zend and Ioncube extension and enable APC.

Enable APC on Godaddy.com Hosting

Here is how to do it:

Open your working php.ini/php5.ini file (it might be in a subfolder or on your root folder)

If you have Zend or Ioncube extensions enabled, and you are sure your sites will work without them, disable these extensions by putting a semicolon (;) in front of each line about them.

If you see “apc.enabled=0” somewhere, comment this line with a semicolon (;) too.

Godaddy Optimized php(5).ini

Here is a nice PHP5.INI (for Godaddy Linux hosting plans using FastCGI PHP 5.3)

Save it as php5.ini and place it in the public root of your server (/html folder). Careful to backup your current php5.ini.

cgi.fix_pathinfo = 1
cgi.check_shebang_line = 0
;register_argc_argv = false
default_charset= "UTF-8"

; Enable GZIP compression at the default level
zlib.output_compression = On
zlib.output_compression_level = 6

; Disable PHP magic quotes
;magic_quotes_gpc = Off
;magic_quotes_runtime = Off
;magic_quotes_sybase = Off

register_globals = off
allow_url_fopen = on

max_upload_filesize = 6M
upload_max_filesize=6M
memory_limit=48M
max_execution_time=30

expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

date.timezone="Europe/Paris"

allow_call_time_pass_reference = on

; Load PDO MySQL extension
extension=pdo.so
extension=pdo_mysql.so

;APC
extension="apc.so"
apc.enabled=1
apc.shm_segments=1
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.enable_cli=1

; Only uncomment zend optimizer lines if your application requires Zend Optimizer support
[Zend]
;zend_optimizer.optimization_level=15
;zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.3.3
;zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3
;zend_extension=/usr/local/Zend/lib/Optimizer-3.3.3/ZendExtensionManager.so
;ZEND GUARD (because we use PHP 5.3)
;zend_extension=/usr/local/Zend/lib/Guard-5.5.0/php-5.3.x/ZendGuardLoader.so
;zend_extension_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3/ZendExtensionManager_TS.so
; -- Be very careful to not to disable a function which might be needed!
; -- Uncomment the following lines to increase the security of your PHP site.
;disable_functions = "highlight_file,ini_alter,ini_restore,openlog,passthru,
; phpinfo, exec, system, dl, fsockopen, set_time_limit,
; popen, proc_open, proc_nice,shell_exec,show_source,symlink"

Now you have APC enabled by default!

Check if APC is installed on your Godaddy account

You can check it by opening a php file containing phpinfo() function.

Here is an example:

Save the code below in a file named: phpinfo.php

<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>

Now you can put this file next to your websites files (careful not to overwrite existing files) and browse to this file with your web browser. Search in the page for “APC”, you will know now…

Keep in mind that these settings apply if you have your hosting with any of Godaddy Resellers, like “DomainsPricedRight.com”

 

Optimize your CS-Cart store

Speed up CS-Cart

Faster websites get better SEO scores and get better indexes in search engines, a Google employee once said “Website should be fast”, your visitors will agree, trust me.

 

CS-Cart more salesFaster and optimized eCommerce websites do sell +40% more than slower ones, just because they are faster. You “will” agree once you see the money come ūüėČ ¬†trust me.

 

In the continuity of my “Website optimization” posts, this time we will see how to optimize CS-Cart, but hints and methods written here are useful for all other platforms, just you will need to adapt, easily.

E-Commerce Optimization

I assume you already know about the ROCK SOLID eCommerce software “CS-Cart”, if not, you are missing BIG!

odience.net|works sponsored this post and asked me to optimize their online marketplace which is based on CS-Cart.

The outcome? A faster CS-Cart store which loads in less than 5 seconds and gets a performance grade of 94/100 and on some pages 99/100 (check for yourself at Pingdom), this literally “ROCKS”.

UPDATE: Based on my work ūüėČ , odience.net|works made a package that CS-Cart users can use to speed-up their stores. Will be available soon!

Now we will see in this post, how you can optimize your site load times and speed.

A little bit more than “few” technical knowledge is required if you want to read on, but you never know, maybe you will learn on the way ūüėČ

I will expose different steps and aspects of optimization which are also applicable with other websites as we saw in my previous posts.

 

Time Matters

From an optimization point of view, even 0.1 second in load time matters so let’s get started.

 

Optimize Cache, Server side:

CS-Cart integrates a built-in cache, but that needs lots of modifications to be “robust” and “reliable”.

Here are some issues with CS-Cart’s cache:

  • It “kind of” compresses the JavaScript files but doesn’t combine them! So you find your self serving multiple files which is BAD for load time.
  • It does not cache external JS files you include with the {script} tag. OK, this might be “over doing” but it might be interesting as for serving “hosted” Google Analytics JS on CS-Cart…
  • It “combines” the CSS files but does not compress them, so you will be sending the user a quite BIG file; and that is BAD for page speed too.
  • It does not compress nor clean the HTML output, and again, BAD for speed.
  • It does not serve files with the right expires header so no one know when to refresh the content! How a browser is supposed to know what and when to cache?

Well, what to do, is to optimize this caching to the maximum and make the page generation faster and faster.

So for example the same time CS-Cart “combines” CSS files, let’s tell it to “compress” the output CSS file. When it compresses JavaScript files “independently” let’s ask for a combined and compressed output file, in the mean while, cache external JS files to limit multi-domain requests for the user.

Backup AlertThese steps are quite complex, and need core modification, so you must be careful when updating/upgrading your CS-Cart installation to keep a backup of your MODs.

SMARTY

smarty logoIf you don’t know it already, CS-Cart runs Smarty for its template engine. Smarty is basically great from an ease of use point of view, but unfortunately, Smarty v2 is not optimized for speed. Well, Smarty did great on its Smarty v3 on speed optimization, and included multiple cache handlers like eAccelerator, APC and others.

APC

Alternative PHP Cache LogoI have to mention that APC caching improves A LOT your site performance, but, Smarty v2 does not contain an APC cache handler, so I made an APC cache handler for Smarty v2, and thus for CS-Cart 3, which makes your content load directly from “RAM” instead of Hard Drive. This means “very fast”.

CS-Cart Core Optimizers

You can download these “Optimizers” from my¬†Downloads page¬†¬†odience Market, instructions included.

 

Optimize Cache, Client side:

To tell the browser which files to cache and which ones to not, your server must send correct “Expires headers”.

Unfortunately CS-Cart does not set theme correctly. This causes your client’s browser NOT to cache and ask for every page element at each request.¬†Seriously, you DO NOT WANT THIS, because, wait for it…. BAD for speed!

You will need to edit your HTACCESS file(s) to send correct “cache” headers to the user directly from your server.

CS-Cart Optimized HTACCESS

You can download a sample of the “CS-Cart Optimized HTACCESS” from my¬†Downloads page¬†and for the full version, check¬†odience Market,¬†instructions included.

 

Combine JavaScript files:

Merge JS and CSS files

As I wrote before, CS-Cart just “compresses” JavaScript files and it does NOT combine the files. You need to combine the compressed JavaScript files to use less bandwidth and send the file FASTER to the user, because JavaScript files are “VERY DANGEROUS” for page speed.

A JavaScript file ¬†literally blocks all other elements from loading until itself gets fully loaded, so you want it to be “alone” and to finish loading, wait for it …. …. …. FAST!

CS-Cart JS Optimizer

Get the “JavaScript Combine&Compress Smarty output filter”; that I wrote; from¬†odience Market,¬†instructions included.

 

Compress CSS files:

Compress content

There are lots of great Open Source projects (ex. Minify) which allow great CSS optimization, combination and compression. I don’t know why CS-Cart does not integrate one such library?

Well, all that said, you need to compress CSS files, and more precisely, Minify them to let users receive just what they need to “style”, nothing more nothing less.

Use less files, Use more SPRITES:

CSS Sprites example

CS-Cart uses a lot of small icons for its base skin.

If your current skin is using more than 20 different icons (not product images, just icons, ex. account icon, cart icon, live help icon, menu drop down arrows,…) you should think about combining them into a single file to decrease the number of requests a visitor’s browser makes to your server. This combination reduces significantly your page load time and speeds up your CS-Cart store. So, go ahead ¬†and combine your small icons into one or two bigger image sprites to reduce file requests as these requests are BAD for speed.

There are some free tools which help you automate and simplify sprites generation:

CS-Cart Sprites based Basic skin

Still not finished, but I am working on creating a sprites based “Basic” skin for CS-Cart, help is much appreciated.

 

Use a CDN for your static contents:

CDN77.com Europe Pops

CDN, CDN, CDN! (It stands for Content Delivery Network if your are new :D)

If you got the $$$ to run with the big guys, go with AKAMAI, Amazon and other big Content Delivery Networks.

But! You can set your FREE CDN too! just serve your static content from a different sub-domain (or domain), for exemple:

Serve images from

https://staticimg.yourdomain.com/images/

while serving your mains website from

https://www.yourdomain.com/

This allows “parallel” downloads which will increase significantly page speed.

Well, serving JavaScript and CSS files from a CDN is something to think twice about, because CS-Cart generates your CSS and JS files every time you refresh the cache so if you are on a CDN, that would happen slower than you expect.

To make CS-Cart “CDN-compatible” you will need to make few changes to your skin’s files. If you focus on moving only your images to the CDN, it would be quite easy, though you should also think about the Addons and their images.

Basically, by overriding the $images_dir SMARTY variable at the right moment, you can tell CS-Cart to go get the images from a CDN, though some minor modifications should be done on core smarty plugin files to let CSS files compile correctly.

Another great idea to setup a CDN for CS-Cart is to mount your CDN space as a partition (mount point) on your server and symlink your static directories (images, css, js, cache) to the mount point, this reduces all synchronisation lags, and saves you from changing core files.

CDN CS-CartBut, a better idea, is to use a “Mirror CDN” like CDN77.com!

 

I already tested CDN77.com and the service is great. They offer a 14 days free trial, which lets you know if you are ready for CDN.

I really recommend them because of the number of pops (servers worldwide) and their affordable price ($4.90 /100GB of data, THIS IS VERY LOW!). So, if you need a CDN, sign up for CDN77.com and make your CS-Cart s

ite faster!

Let me explain on how to use a mirror CDN for your CS-Cart ecommerce software:

  1. Open an account on CDN77.com
  2. Create a new CDN
  3. If you need SSL (I recommend it if you have a secure store)
  4. Choose Free SSL (shared)
  5. or choose a custom SSL (ex.: “https://cdn1.gibni.com/” for 39$/month)
  6. Let 4 minutes pass by, for the CDN to be setup of course!
  7. Modify your CS-Cart store to serve images (you can do it even for CSS and JS, but not really needed, as you would have less than 5 JS and CSS files; it’s up to you!)
  8. Enjoy your Free CDN! (Yes, as simple as that, weird huh?)

 

Use a cookie-less domain for static components:

CS-Cart Cookie

Sites setting cookies will send/set the cookie file (0.8 – 1.5 KB) for each requested component (even for static images and css/js files).

These static contents do not require a cookie file, so by using a subdomain, or another domain (like a CDN), you will be able to get this point fixed and make your static components “cookie-less”, i.e. about 1K size reduction per element, so again, read the previous section about CDN to setup one for your images (at least).

 

Optimize your server with HTACCESS and PHP.INI tweaks:

Php.ini and Htaccess optimization for CS-Cart

To oil the gears of your server, you might need to have a look at your .htaccess and php.ini (php5.ini) files.

 

Some stuff you could do:

  • Set Expires headers based on file types,
  • Tell the browser to cache CSS and JS files,
  • Unset ETags,
  • Set Gzip/Deflate compression for your HTML/PHP files,
  • Secure access to your server and store,
  • Secure file requests and prevent file request attacks
  • Make sure downloadable files are downloadable! weird, huh?!
  • Add the “missing” trailing slash in your URLs,
  • Rewrite requests to WWW,
  • Force secure connections through HTTPS
  • Install a Virtualized Software Firewall through HTACCESS to protect yourself from hackers
  • Protect ¬†your server and store from unauthorized queries and requests
  • Speed up the server with the PageSpeed Apache module
  • and so on…

Specially with PHP.INI (PHP5.INI) you could:

  • Set a default FROM address directly on the server to get your emails “delivered”
  • Increase execution times and upload file sizes to optimize performance and ease file uploads
  • Activate ZEND extensions to boost your server
  • and so on…

CS-Cart optimized PHP.INI & HTACCESS

Check the optimized PHP5.INI file (created and tested on Godaddy.com’s Shared hosting) and a tweaked (basic) HTACCESS for CS-Cart at my Downloads page.

 

Conclusions

There is a lot to do for a better web, by optimizing your websites and e-shops, you use less bandwidth and energy. Apart from making better sales and getting better SEO scores, you make a greener world. Do not hesitate about optimization.

APC caching for CS-Cart 3 and Smarty 2

Today I got and email from Godaddy saying that Godaddy.com is implementing APC cache from 1st October 2012. APC cache helps your pages load a lot faster, but it is not always easy to implement it into your software. Smarty, the template engine, implements the APC cache from its version 3, but the older versions of Smarty, are a bit trickier to master.

Finding a good way of implementing APC cache to your Smarty 2 is a challenge, but don’t worry, I am here :D.

Here is a method to implement APC cache to your CS-Cart eCommerce software, which is using Smarty 2 as its templating engine:

You need to:

  1. Create a SMARTY cache handler for handling APC cache. Be careful that your APC cache handler must be compatible with SMARTY 2, as of CS-Cart 3 is concerned.Here is the APC cache handler code for Smarty 2:

    Save this code as “cache.apc.php” and place it in your Smarty’s “plugins_dir” folder. (for CS-Cart, save it in:

    <CS-Cart ROOT>/core/smarty_plugins/

    Download APC Cache handler for Smarty 2, useful for CS-Cart 3 from my Downloads page

  2. Modify the CS-Cart core files to initialize APC caching (careful with this step as it requires core modifications)For instructions about the CS-Cart modifications, please contact me.
  3. Enjoy faster loading CS-Cart store!

 

Optimize JA T3 Framework on your Joomla website

After a long long time, I’m back again ūüėÄ

I’m give you a little trick to speed up your Joomla website and optimize its loading time.

If you are using the JoomlArt.com’s JA T3 Framework, which is really great, you might experience slow joomla website and long wainting times until something shows up!

Pages being slow are a pain for the visitors and might make them go away from your website.

I found out that if you enable the CSS and JS¬†optimise¬†options from your template’s settings page, the requests made to the¬†optimised¬†CSS and JS files are redirected multiple times which causes serious performance issues and slows down your pages! Strange huh??

 

That is because of a bug in the JAT3 base system plugin. Here is the fix:

Open the file:

<JOOMLA_ROOT>/plugins/system/jat3/head.php

Replace the “buildURL” function (from line 814 until 835) with the following:

 

    function buildURL($url)
    {
        if (JPluginHelper::isEnabled('system', 'languagefilter')) {
            $lang_codes = JLanguageHelper::getLanguages('lang_code');
            $default_lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
            $default_sef = $lang_codes[$default_lang]->sef;
            $app = JFactory::getApplication();
            $router = $app->getRouter();
            if ($router->getMode() == JROUTER_MODE_SEF) {
                if ($app->getCfg('sef_rewrite')) {
                    $url = JURI::base(true) . "/" .$default_sef. "/?$url";
                } else {
                    $url = JURI::base(true) . "/index.php" . "/" .$default_lang. "/?$url";
                }
            } else {
                $url = JURI::base(true) . "/index.php?lang=$default_sef&$url";
            }
        } else {
            $url = JURI::base(true) . "/index.php?$url";
        }
        return $url;
    }

 

[Resolved] WordPress : Custom Fields not working and not getting updated issue

Time solves your problems

I’ve had a problem with WordPress last 3 months, and at last, I found the solution. Here is the story:


WordPress Custom Fields

WordPress posts have meta data (Custom Fields) where additional information on the post are stored. For example the featured image, number of views, comments count, keywords,¬†SEO description¬†and so on…

When posting new posts, the¬†Custom fields where not getting stored on WordPress, so basically nothing was “tracked” and optimized. I looked everywhere on forums and internet resources for a solution to this issue, no luck!

Today I was rechecking Gibni’s data base and in the “post_meta” table, I found that “meta_id” was not set to “auto_increment”. You can see this in the “extras” column in phpMyAdmin while you¬†see the “post_meta” table’s structure. Once setting this parameter to the “auto_increment” value, everything got back in order.

Problem Solved!

Now all the “custom fields” get stored and updated as they should. If you have the same issue, check your database!

SEO Super Comments – Update

Improve your SEO and increase Pageviews

There’s a great plugin for the WordPress platform, called SEO Super Comments, which creates a single “virtual” page for each comment on your site. It increases the number of pages you have on the site, and improves your SEO a lot. Read more on SEO Super Comments on the authors page: SEO Super Comments by Vladimir Prelovac¬†.

“The concept relies around optimizing the target page using title and H1 tag using the context of the comment. So basically we will take the excerpt of the comment and use it to create the page title and H1 tag and in the body we will hold the content of the comment…” says Vladimir.

 

 

 

Download modded Google XML Sitemap Generator 3.2.3

I created a modded version of XML Sitemap Generator 3.2.3 to work with SEO Super Comments which puts all your comments pages in the sitemap, and once submitted to Google, you should see a huge raise in your traffic.

Installation

To install, you should replace the downloaded sitemap-ui.php and sitemap-core.php in your Google XML Sitemap Generator Plugin’s directory and overwrite the original files. I would recommend you back up your original files.

Once installed, Go to your administration panel, and to the XML Sitemap Generator settings, and check the ‘Include Comment Pages’ option, click ‘Update Options’ at the bottom, and “Rebuild Your Sitemap”

I personnaly recommend this plugin and would thank the developper for it.

Please send your comments and queries here if you have any issues regarding my modded version of Google XML Sitemap Generator for WordPress.

Donate

Please go to the Donations Page  and contribute to the developpment of more updated plugins if this modded version helped you increasing your traffic.

Emergency code

Who to call in case of website emergency?

Due to some yet unknown issue, WordPress version 2.8.2 might be causing server errors.

Lunarpages, my “current” and might become “ex” webhosting company, shut down Gibni.com yesterday without any prior notice, saying they’ve taken an emergency action, as the “index.php” script in my wordpress root was using huge server resources, and could cause a server crash.

First problem is, not only they changed the “index.php” permissions to “000”¬† (no read permissions) but they took ownership of the file, so neither I could make any changes to the file, nor analyze it for troubleshooting.


Secondly, they made the domain return an “internal server error” to all visitors.


Third, they did not manage to put an “under maintenance” page at the root untill the issue is solved.


Anyway, thanks to my linux skills, I managed to put an “under maintenance” page for Gibni, and get the site back online very soon.


Until I figure out what caused wordpress to eat server resources, and was it really wordpress or Lunarpages’s poor servers and administration, was it the running theme which ran without any issue for months or even the plugins installed on wordpress a year ago; I’ve decided to switch back to wordpress default theme and upgrade to wordpress 2.8.4.

After all, I believe that you should now:


  • Enjoy Gibni, Ad free!
  • Always have a maintenance page and an emergency code, just in case!
  • Be careful choosing your webhosting company!

Making money online, avoiding the scams

Making money online…

Making money online is one of the most researched topics for many of web developpers, bloggers and website owners. It takes a lot of efforts to produce quality content and get enough traffic, to be able to rank better in search results and improve your different ranking factors. After a while of being online, website owners will get advertising offers from different companies, which might be interesting at first.

Well, this is a good sign, as it means that your site is getting some interest and attention; but it’s also an alert, warning you to be cautious.


There are lots of scams out there, which try to fool you by offering great business opportunities and make you run some ads or malicious scripts on your website. They (the scammers) will try to get detailed information about you, your website, personal details and even your bank account(s). scam


You Should be carefull…

You would get an email, from an unknown party, who shows interest in your website and usually represents himself as an advertising company who wants to buy some ad space, or publish some content on your website (or blog) for one of his clients.

First thing to do is : DO NOT reply with your personal information and¬† DO NOT show that you’re very interested!

Second, start to gather some information about the company who sent you the email. See its WHOIS record (you can use InterNIC WHOIS ) to find out more about the website owner, registrar, their address, and phone numbers if any.

Use your favorite search engine to find out more about the company, visit their website, check their “About us” page, check their portfolio, recent clients, latest works…

Look for user reviews on the company, search to find out if ” {the company name} + scam ” returns anything in your search engine? Search and investigate a little bit to keep your website (blog) safe from advertisement scams.

Use SiteAdvisor form McAffee to check if the website is a safe website or not.

If you come across any types of scams, just DO NOT reply to their emails and ignore them. You would help other website owners and bloggers if you write a post on how to identify scams and spams and how to avoid scams.

You can share this post and link back to it from your website (given that you mention the source).


Recently I’ve came across a scam from Production-Time.com . They’ve sent me an email in French, in which they shown interest in Gibni.com and asked me to reply if I wanted some more information.

I’ve done a WHOIS research and some investigation and found out that the email, even if it was well personalised, has been sent to thousands of people and some website owners have already announced Promotion-Time.com as a scam. I’ve found a detailed article about this scam in EPN.dk, which I translated to English to be able to understand it.

Here’s the a part of the email they’ve sent me:


Bonjour,
J’aimerais vous faire part d’une proposition commerciale √† propos de votre site Web, qui pourrait tr√®s fort vous int√©resser.
En effet, ma soci√©t√© Promotion-Time, souhaiterait vous r√©mun√©rer pour la publication d’une petite publication textuelle sur votre site pour un de nos clients.
Il s’agit d‚Äôune annonce francophone cibl√©e qui convient √† certaines pages de votre site.
N’hésitez pas à me contacter si vous avez besoin de plus amples informations.

Sincèrement,
Francq Petit
francqp@promotion-time.com

Si vous ne souhaitez plus recevoir d’emails de Promotion-Time, répondez à cet email avec comme sujet : STOP.
It is possible to continue this correspondence in English, if you prefer to do so.


Here in this post, you can help the community by letting other know about the scams you faced and also know about scams already running on the internet. Type in the information you have in the comments section (Be carefull not to spam the comments section) .


Making money online, avoiding the scams, aims to help you avoid scams, help spread the word and show your support.

Posts and comments in ‚Äúany‚ÄĚ language in WordPress!

Have you ever thought of writing your blog posts in a language other than English? or even let your visitors leave comments in another language!?


Well, some may answer with “Yes! in French!” (or Portuguese, or Italian…), but, what I mean is in other languages like Arabic, Farsi (Persian), Urdu, Chinese…, languages which have characters other than the basic “A,B,C…”

Basically, when you write a blog post on your blog, it is stored in a database, and what characters that database supports, defines the characters you can use for writting your post.


Well discuss about the two general types of WordPress, the WordPress.com blogs and self-hosted WordPress installations.


WordPress.com blogs:


Typing other languages such as Farsi or Russian or Arabic should be supported by default and you should be able to write in almost any language without problem.

But if it’s not enabled on your account, according to Fatih Syuhud [1], you should:

– Login to your administration area on WordPress.com

– Go to “Settings” > “Reading”

– and set the encoding for “Pages and Feeds” to “UTF-8”

This procedure gives you the possibility of writing all kind of characters on your pages and posts and feeds.

Encoding for other specific character:

  • Latin/Hebrew: ISO-8859-8
  • Hebrew: windows-1255
  • Latin/Arabic: ISO-8859-6
  • Arabic: windows-1256


Self-hosted WordPress installations:

Remember that you take full responsability for the modifications and actions you do on your blogs/sites! Proceed at your own risk.


The contents of posts are stored in a table called wp_post (by default) inside your WordPress main database.

What defines the type of characters supported by a table, are the charset and collation of the table.

By default, all installations of WordPress (prior to 2.3.1), use the latin1_general_ci (or latin1_swedish_ci) encoding for their rows and tables.


To post articles in Arabic or Farsi (Persian) (or Urdu, Chinese, Russian…), you should change the encodings of specific tables and respective rows to utf8_general_ci.


Step One: Backup


You should first of all, backup your files and database! use Lester ‘GaMerZ’ Chan’s WP-DBManager plugin, or do it manually by following the procedure from this article: WordPress Backups.



Step Two: Convert


First Solution proposed by Fatih and Mukhlas Rowi [3] ( 70% success rate , maybe some data loss)  is:

– Open your WordPress database in phpMyAdmin (in cPanel),

– Click on the “wp_post” table and then click on “Operations”,

– Change the collation to “utf8_general_ci”,

– Save.

– Now, browse to the “wp_post” table, and check all rows with a collation attribute,

– Click on “Edit” bellow the list of selected rows,

– Change all collations to “utf8_general_ci”,

– Save.

That’ it.


Second solution: Use a plugin to do the conversion! I’ve tested the bbwp2UTF8 plugin and it works great (at least with WordPress 2.7.1), you can download it from my Downloads Page or from WordPress.org home page: bbwp2UTF8 Home page. ( 30% success rate, big data loss)


– Install the bbwp2UTF8 plugin by extracting its content in your plugins directory (usually /wp-content/plugins ),

– Go to the plugin’s page (link is below the “Plugins” section on the left side of the page in WordPress 2.7) .

– Check the desired tables to convert ( I recomment you convert all tables),

– Proceed with the steps to complete the conversion procedure.


That’s all! Your database and tables have been converted in the right manner, and you should not face any loss of data.


(In case you don’t like the plugin suggested above, or it doesn’t work for you, you may try: UTF-8 Database Converter by g30rg3_x ( I haven’t tried this out!) )


Geeks’ solution: Follow the guide at WordPress.org : Converting Database Character Sets



Now you can type UTF8 characters in WordPress and let your visitors type in UTF8 characters in the comments section.



Read More here:

http://codex.wordpress.org/Converting_Database_Character_Sets

http://www.haidongji.com/2008/11/11/convert-character-set-to-utf8-in-mysql/

http://www.prelovac.com/vladimir/ultimate-solution-to-weird-utf-character-encoding-problem

http://codex.wordpress.org/Editing_wp-config.php#Database_character_set

http://www.haidongji.com/2009/02/16/perl-script-to-convert-mysql-character-set-to-utf8/

http://wordpress.org/extend/plugins/utf-8-database-converter/installation/

Ref:

[1]- http://fatihsyuhud.com/2009/01/16/how-to-enable-arabic-letters-in-wordpress/

[2]- http://codex.wordpress.org/Converting_Database_Character_Sets

[3]- http://www.mukhlas-rowi.web.id/2008/11/11/mengatasi-problem-penulisan-huruf-arab-di-blog/

How a bot sees your website?

This time, I’ll write about SEO, i.e. Search Engine Optimization.

First of all let’s agree on one point, we should build websites for people, not bots, but people find us through bots.

So keeping in mind to build “useful and good content“, let’s see how a bot sees your website?

First of all, for some people who are completely new to the topic, a bot is a kinda program (or software) used by search engines to browse the Internet and saves all the information it can read in the search engine’s index, and bots, basically are Text Browsers, and they read your website, they don’t see it the way humans do!

…So that way search engines know about everything!

Bots travel through websites by following links on one page and jumping back and forth through different pages and websites.  You may ask why you should care about a bot (or sometimes called a spider) and the way it sees your website?

The answer is that you should be aware that bots build a search engine’s index and they introduce your website to the index. So your website will appear on the search results of a search engine the way you shown it to the specific bot!

To make your website search engine friendly, you should know few tips.

1- Build websites for people, not for bots.

2- Put the most important content on the top, in the code (html, xhtml, php, asp, etc.).

3- Make a navigation menu and a navigable one!

4- Use formatting styles as headings and bold or italic text where appropriate.

5- Optimize images and use “alt” text for ALL images.

6- Use CSS positionning techniques to place your content on your page.

7- Browse your website with different browsers and on different platforms.

8- Bots are basically TEXT BROWSERS! use a text browser to see how your website look in it. Use Lynx!

You can find Lynx for Windows on my downloads page.

Lynx is easy to use, and there’s a good documentation already built in. But to get you started, once installed, start Lynx, and at the prompt, enter “g”¬† (without the quotation marks) and it will ask you for the URL you want to go to… and you’re good to go!

9- Create strong and complete header meta descriptions and keywords.

10- Choose your page titles carefully and responsibly.

11- Introduce your website to different listing directories.

By providing good and useful information to a bot when it comes to your visit, you will help the search engines to bring you the right visitors and the most important thing is that a visitor will come to you, because he wants to, and not by chance or mistake.

Worst thing which can happen to a visitor is to click on a search result, start to read a site’s text and advertisements all around and at the end say “This is the wrong place! I lost my time!”

Build great content and present it right!