0

Apache webserver.

I don't want to customize the content management system (MediaWiki) but I do wish to not serve some of its HTML elements, via the webserver, based on their CSS selector (ID/Class).

Pseudocode

<If elementInRequestedWebpage CONTAINS_SELECTOR "#x">
    removeElement;
</if>

Can this be done?

vidarlo
  • 3,775
  • 1
  • 12
  • 25
  • Modify the CMS. It's far easier and less complex solution to manage. – vidarlo Mar 08 '22 at 10:53
  • @vidarlo in general sense I totally agree, but this is a complex CMS (MediaWiki) with many aspects hardcoded in source code, more than any other CMS I know, there isn't even a theming system as you would find in Drupal/WordPress/Joomla; theme files are normally clusterfucks of ~ 1500 lines and I as a non PHP programmer would prefer some server tweak. – technology-liker Mar 08 '22 at 15:34
  • Apache2 cannot do complex content modification like this. Also, content modification like this is very fragile to all kinds of side effects. Also making reliable testing for the modifications is really complex problem. Furthermore, doing modification like this over HTML requires complete HTML parsing, which is very expensive in terms of processing. If you still want to do it, you can look into nginx and its JS module, or nginx lua module. – Tero Kilkanen Mar 10 '22 at 18:30
  • @TeroKilkanen you have reminded Nginx lua which very "catches" me because Lua is the programming language of MediaWiki (as you probably know). Perhaps I can do some stuff like this from MediaWiki itself with Lua? – technology-liker Mar 10 '22 at 21:06
  • Oh, and one more thing, I host my website on a shared hosting on Namecheap, I don't think I can control Nginx, rather, only Apache `.htaccess`. – technology-liker Mar 10 '22 at 21:10
  • Then your only option is to do the modifications in MediaWiki. How to actually do those is too big a subject for a Q&A site like Serverfault. – Tero Kilkanen Mar 12 '22 at 08:14

0 Answers0