1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Can i hide parts of a webpage content via some Apache module?

Discussion in 'Apache' started by postcd, Mar 8, 2017.

  1. #1
    Hello,

    there are Apache modules like pagespeed which rewrite page upon serving it to the customer
    there is mod_security module which i hope can also do actions based on page content

    so how can i please hide/remove parts of webpage while sending it from the server to the visitor?

    Example, i want to remove this from certain or all Apache served pages:
    <a href="http://badsite.com/?a=123">Link text</a>
    HTML:
    so my question is how to do it please? How to intercept/modify data Apache is going to send to my website visitor? Thank you in advance
     
    postcd, Mar 8, 2017 IP
  2. KingViper

    KingViper Member

    Messages:
    49
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    48
    #2
    I might be wrong,
    but I don't think you could do this on the server level.
    I believe you would need to fetch the web page first, then remove the link based on a predefined regex (could be done with javascript, but also with PHP) and then serve it to the visitor. This would require you to act as a proxy between the origin and the visitor and depending on the number of visitors and different sites which you need to process, it might be quite expensive in terms of server resources.
     
    KingViper, Mar 9, 2017 IP
  3. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #3
    You could probably do this via one of the proxy-scripts for Apache - Varnish, for instance. However, this is quite demanding on server resources, and would normally be running on a separate server, not on the same box as the webserver itself.
     
    PoPSiCLe, Mar 9, 2017 IP
  4. postcd

    postcd Well-Known Member

    Messages:
    1,037
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #4
    thx, i need some tutorial or example, so if no one knows how to do it exactly (i do not use Varnish, i use Apache+Mod Security), please share phrasse/s that i will search in Google to discover how to do it. Thx
     
    postcd, Mar 13, 2017 IP