Gossamer Forum
Home : Products : Gossamer Links : Discussions :

topdomains only

Quote Reply
topdomains only
Hi,

Is there a cool trick I can use to limit URL so it will only accept toplevel domains.. whatever.com, whatever.xx, www.whatever.com, www.whatever.xx, etc.. no subdirectories or pages..

also, i'm looking for a trick to remove the URL's in the database that already got in there with subdirs and subpages

Regards Dane
Quote Reply
Re: [dane] topdomains only In reply to
You could enter the URL regex to something like;

^http:\/\/(www\.)?[a-zA-Z90-9_]\.[a-zA-Z0-9\.]{2,6}

This won't definatly work (my regex is far from good). Maybe Paul, or someone from GT could give you a more effecient method.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [dane] topdomains only In reply to
To restrict sub-directories try:

Code:
^http://[^/]+/?$

That will allow http:// then anything without slashes and then an optional trailing slash, so it will match:

http://foo.com
http://www.foo.com
http://subdomain.foo.com
htp://www.foo.com/

...but will reject...

http://www.foo.com/directory
Quote Reply
Re: [Paul] topdomains only In reply to
Thanks a lot for that guys, just what I needed Cool