How to add any word from the address bar after the domain to a specific field on the site?

  • 0
    Hello.
    How can you add any words after the domain through a slash in a specific field on the site? For example, a person went to the site at https://site.com/promo , the word "promo" and you need to add into a specific field on the site. Thank you.
    JavaScript Anonymous, Jun 28, 2019

  • 1 Answers
  • 0
    No slash:

    $url = $_SERVER["REQUEST_URI"];
    $urlnoslash = trim($url, '/');

    echo $urlnoslash;
    Holden Waters

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!