Is there a quick way to detect redirections?

Viewed 31

I am migrating a website and it has many redirections. I would like to generate a list in which I can see all redirects, target and source.

I tried using Cyotek WebCopy but it seems to be unable to give the data I need. Is there a crawling method to do that? Or probably this can be accessed in Apache logs?

1 Answers

Of course you can do it by crawling the website, but I advise against it in this specific situation, because there is an easier solution.

You use Apache, so you are (probably) working with HTTP/HTTPS protocol. You could refer to HTTP referrer, if you use PHP, then you can reach the previous page via $_SERVER['HTTP_REFERER']. So, you will need to do the following:

  • figure out a way to store previous-next page pairs
  • at the start of each request store such a pair, knowing what the current URL is and what the previous was
  • maybe you will need to group your URLs and do some aggregation
  • load the output somewhere and analyze
Related