How to Fix Special Character & Transliteration Issues in WHMCS URLs (Custom Hook)

Hello everyone. One of the most common issues when using WHMCS with non-English languages is the URL Slug / Transliteration problem. Special characters (like UTF-8 chars) often break SEO-friendly URLs or appear as garbled text.

Many users try to fix this by editing core server files (Apache .htaccess or Nginx configs), which is risky and hard to maintain. Today, I'm sharing a clean, permanent solution using the native WHMCS Hook system.

With this simple PHP hook, you can automatically sanitize your URLs by replacing special characters with their Latin equivalents (e.g., converting 'ç' to 'c', 'ö' to 'o', etc.) without touching your server config.

How to Install

Follow these steps to fix your URL structure instantly:

  1. Connect to your WHMCS directory via FTP or File Manager.
  2. Navigate to: /includes/hooks/
  3. Create a new file named custom_transliteration.php.
  4. Paste the code below into the file.

Note: The example below is set up for Turkish characters, but you can easily edit the $search and $replace arrays for German, Spanish, French, or any other language.

<?php
/**
* WHMCS Custom Character Transliteration Hook
* Automatically converts special characters in URLs and Modules.
* Ali Comez - Megabre Engineering
*/

add_hook('TransliterateString', 1, function($string) {
    // Characters to find (Add your language specific chars here)
    $search = array('ç', 'ş', 'ğ', 'ü', 'ö', 'ı', 'Ç', 'Ş', 'Ğ', 'Ü', 'Ö', 'İ');
    
    // Characters to replace with (Latin equivalents)
    $replace = array('c', 's', 'g', 'u', 'o', 'i', 'C', 'S', 'G', 'U', 'O', 'I');

    $string = str_replace($search, $replace, $string);

    return $string;
});
?>
⚠️ Important Note:

This hook applies to NEW content and URLs generated after the installation. To fix existing (old) broken URLs, you need to open the specific knowledgebase article or product in your admin panel and click "Save" again. This forces WHMCS to regenerate the slug using the new rules.

Enjoy your clean URLs!

Was this answer helpful?