How to Enabled mod_rewrite Debug Log in cPanel


If you are using mod_rewrite & find out some problem, you may need to do some debugging with the log write somewhere. For CentOS system with cPanel together with Apache or LiteSpeed, you may enabled mod_rewrite Debug Log as below.

  • Edit Apache configuration located in “/etc/httpd/conf/httpd.conf
  • Find the corresponding VirtualHost for your domain which you want to debug.
  • Add “RewriteLogLevel 9” underneath “UseCanonicalName” as below and save.
<VirtualHost 100.100.100.100:80>
  ...
  ...
  UseCanonicalName Off
  RewriteLogLevel 9
  ...
  ...
</VirtualHost>
  • Restart Apache or LiteSpeed
  • The Debug Log will be written in “/usr/local/apache/logs/error_log” file.

Remove AdSense in 404 Not Found Page in phpMyDirectory


Recently, I warned by Google AdSense team because AdSense displayed on 404 Not Found Page in phpMyDirectory website which they don’t allow. In their email, it clearly stated that AdSense must not be displayed on this page as shown below.

Violation explanation

In order to ensure a high quality user experience and appropriately targeted ads, Google ads may only be placed on original, information-rich content that’s easy for users to navigate.

Ads should not be the main focus of the page and/or be more prominent than the content itself. This may include pages that a user visits before potentially exiting a domain (i.e., “exit pages” or “thank you” pages), 404 error pages, and some log-in pages. As our ads are contextually targeted, image galleries with little text are also not the best place for our ads.

In order to comply, add the AdSense code as shown below where you want to insert the ads.

<?php if(http_response_code() != 404) { ?>
// AdSense Code
<?php } ?>

Page 3 of 5312345...102030...Last »