I need to determine if a URL entered by a site user is not broken. Essentially, that means it delivers a page that an anonymous user can view.
I’ve seen examples that say “if url returns 200” or “if url does not return 404” as methods used. Say, for example, it returns 301 or 403. These are largely similar (in the definition I’m using here) to 200 and 404 respectively.
What is the best way to test if a url is valid based on http status codes?
Anything above 400 denotes an “error”. 300’s are used for redirects.