Hello to all. I need your help - I need to write a condition: if the URL contains / administrator / then the condition is met. The URL can be site.ru/administrator/, or site.ru/administrator/index.php?option=com_k2&view=media and any other kind. Please help me create a regular expression or solve a problem in another way. Thank you in advance.

  • $_SERVER['REQUEST_URI'] and strpos() to help you - jackrv
  • 3
    . if (strpos ($ _ SERVER ['REQUEST_URI'], 'administrator')! == false) {// logic} - etki

2 answers 2

 if (strpos($_SERVER['REQUEST_URI'], '/administrator/') !== false){ //выполнение условия } 

    Solved the problem if(preg_match("/administrator/", $_SERVER['PHP_SELF']))