Sometimes, when viewing a website on a mobile device, the page may display incorrectly, showing random characters, “gibberish” text, or broken formatting. This issue is usually caused by how some mobile carriers handle web traffic.

 

Problem

  • On certain mobile networks (e.g., AT&T, Vodafone), web pages may appear corrupted.

  • If you check the page source, you may see random characters inserted into the code.

  • The issue typically occurs only on cellular data connections (3G/4G/5G).

  • When using Wi-Fi, the problem does not occur.

 

Cause

  • Some wireless providers use non-transparent proxies that modify web content in transit.

  • These proxies attempt to optimize performance by:

    • Removing whitespace

    • Compressing or altering code

  • Unfortunately, these automatic modifications can break existing code, causing display errors.

 

Resolution

To prevent proxies from altering your site’s content, you must instruct them not to transform your pages. This is done by setting the Cache-Control: no-transform directive.

Option 1: Set in PHP

Add this line at the top of your PHP files: 

<?php
header("Cache-Control: no-transform");
?>

Option 2: Set in .htaccess

If your site runs on Apache, add this to your .htaccess file:

Apache

<IfModule mod_headers.c>
  Header set Cache-Control "no-transform"
</IfModule>

Tip:

  • To apply this site-wide, add it to the .htaccess file in your public_html directory.

  • To apply it only to a specific folder, place it in that folder’s .htaccess.

Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution