When you browse on an iPhone, you've probably thought "ugh, these ads are annoying" at some point. These days there are ad-blocker apps like "Ad blocker" that work even on non-jailbroken devices, but they only work in Safari, get caught by ad-blocker detection tools, and are kind of a hassle in various ways. If you rewrite a file called hosts, the block works in browsers other than Safari too, and Adblock checkers won't catch it either.
Ads inside apps like YouTube won't disappear with this method, so for those, please use a dedicated tweak like "YouTube Tools" separately.
How to rewrite the hosts file
With this method, you can rewrite the hosts file directly on the iPhone or other device, so you don't need a PC. You'll also need Filza, so install it from Cydia ahead of time.
When you operate on system files, you need to be extremely careful. If you mess it up, your iPhone may stop working properly. Before you start, please read the "Disclaimer" on this site.
A pre-edited hosts file has been created by a kind volunteer, so we'll use that. Open GitHub - hosts-iphone, and tap "Download (zip)". When you open the download URL, you'll see a screen like this.

Tap "Open in Filza".

Tap the downloaded "hosts_iphone-master.zip" to unzip it. Once unzipped, a folder will be created. Open the folder and navigate down to "hosts_iphone-master".

The only file we'll use is "hosts", so the other files aren't needed.

Next, press the "Edit" button, select the hosts file, and tap Copy. Then navigate the displayed directory to "/etc".
Go in the order: Documents (current directory) → User → / → etc.

Once you've opened /etc, tap Paste. If it overwrites the existing file, installation is complete.
Trying it out for real
Let's check whether the ads that usually show up are now gone. By the way, you can also confirm the effect on this site.

When I try displaying it, you can see the banner on the top page is gone. Trying it in Chrome too,

it was properly gone! Depending on the site, the area where the ad used to be will be left as a blank space, but this also lets you save precious data usage.