Jump to content

filter for domain and toplevel domain

Recommended Posts

There is an issue I have with creating a filter for the correct domain and toplevel domain. For example google.com is correct and all the other not.


my code:

     function my_funct($data2) {        $data2 = preg_replace('#(http://www.|http:|https:|ftp://www.|https://www./|//|www.|htp:|htt:|htp:/|htt:/|)#  ' , '', $data2);         return $data2;         }

but directories wil not be blocked


like www.google.com/directory/page/page2


is there a way to use preg_replace and put only domain and toplevel domain in it?


maybe it is possible to negate it, but he entire validation of pre_replace would be changed I assume.

Edited by WesleyA
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...