Support » Fixing WordPress » How to identify external urls of specific domain & do something with it

  • Hello,
    using theme functions.php how do i identify external urls of specific domain & do something like replace,etc..with these urls ?

    • This topic was modified 1 year, 5 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @berserk77,

    Do you want to check the referer link? In that case you can read the $_SERVER[‘HTTP_REFERER’] value and act on that.

    If your site excepts multiple domain names and you want to change content based on that domain you can check the $_SERVER[‘SERVER_NAME’] value.

    Hope that helps,

    Stephan

    https://developer.wordpress.org/reference/functions/wp_get_referer/
    Look at this code look for the variable or the reference added by a WordPress module.
    This function performs a redirect with no default value, the false shown below. return wp_validate_redirect( $ref, false );
    This function use allowed_redirect_hosts
    It is a good example for coding.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to identify external urls of specific domain & do something with it’ is closed to new replies.