Current Location: Home> Latest Articles> How to Remove Ads from a Dedecms Website by Modifying the Source Code

How to Remove Ads from a Dedecms Website by Modifying the Source Code

M66 2025-07-08

Steps to Remove Ads from Dedecms Website

To remove ads from a Dedecms website, we need to modify the source code to block the advertisement content. This article will walk you through the detailed steps, including code examples, to help you successfully eliminate ads and improve the user experience of your site.

Backup Website Files

Before making any modifications, it is essential to backup your website files. You can use FTP tools or the control panel to back up the entire Dedecms website folder to prevent any unexpected issues.

Modify Dedecms Core Files

Next, we need to modify Dedecms core files, specifically in the /include/common.inc.php file. This file contains global settings for the website and includes the code related to advertisements.

Locate the following code:

<span class="fun">require_once(DEDEDATA.'/d.inc.php');</span>

Comment it out or replace it with the following code:

<span class="fun">// require_once(DEDEDATA.'/d.inc.php');</span>

This modification will prevent Dedecms from loading the configuration file related to ads, effectively removing the ads from your site.

Clear Cache

After making these changes, you need to clear Dedecms cache files to ensure that the modifications take effect. You can log in to the Dedecms backend, go to “System” – “Basic System Settings,” and click the “Update Cache” button, or directly delete the cache folder located in the data directory of your website root.

Check the Effect

After completing the above steps, refresh your website and check whether the ads have been successfully removed. Make sure that ads are no longer displayed on any page of the site.

Summary

By following the steps above, we successfully removed ads from a Dedecms website by modifying the source code. After editing the core files and clearing the cache, we were able to block the ads and make the website cleaner and more professional. These steps are simple and effective, helping you optimize the site and enhance user satisfaction.