The problem I'm having is more to do with how the server/browser handles slashes (adds or removes them without me seeing) and being able to determine whether a change has happened so I'm using the `correct` value in my database.
The browser doesn't care, it will happily request a URL any way it is given. It is the server that decides what the URL needs to look like. So, I agree that you should query the URL live and if the server redirects it then update your database accordingly (only if it is a permanent redirect, not a temporary redirect).
But this method doesn't work on my tests for the host main page URL..
If I remove slash and visit https://www.gov.uk I don't get redirects to https://www.gov.uk/
Because there is no need for such a redirect, as they are logically the same URL. This goes back to
my earlier comment about needing to follow the normalization and comparison rules defined in
RFC 3986. For instance, you should consider normalizing the URLs that you store in your database.
The application I feed these URLs into acts like a browser (in fact it is a form of browser) and it waits for internal redirects to happen e.g. (slashes added/removed), so it needs to be using `correct` values for further tests to work e.g. confirming database URL is `correct`.
Then it is using broken logic, as there is no guarantee that a redirect will occur on any given URL. That is entirely up to the server. If you request a URL, you will get either a success, an error, or a redirect. That is all you have to go on, so act accordingly. If you request a URL and get a success, then the URL is 'correct' regardless of how the server decides to process it.
So I guess I'm looking for component that tracks internal redirects?
There is no such thing as an "internal redirect". Either the server redirects or it does not. That is an explicit response.
When you drag the URL from your browser address bar to your Mousepad, you are being given a normalized URL, not the exact text typed into the address bar.