+ Reply to Thread
Results 1 to 10 of 10

Check status for url and validate redirects

  1. #1
    Registered User
    Join Date
    08-13-2009
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    20

    Check status for url and validate redirects

    Hi

    I need some help to modify a a VBA code.

    The sheet should have 4 columns: URL, HTTP Status code, Redirect, Redirect HTTP Status code.

    I have found this code and it can fill out the first two columns.

    Please Login or Register  to view this content.
    Basically I want to check the HTTP status code of many URLs. When the status code shows a redirect I should get the redirect URL and the status code of the redirect URL. Is it possible?

    Best regards
    Morten

  2. #2
    Registered User
    Join Date
    10-30-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007 Pro
    Posts
    27

    Re: Check status for url and validate redirects

    That was fun!
    Please Login or Register  to view this content.
    Last edited by jeremyfox36; 11-25-2014 at 12:42 PM.

  3. #3
    Registered User
    Join Date
    08-13-2009
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    20

    Re: Check status for url and validate redirects

    Hi Jeremyfox36,

    Thank you very much. It works perfectly :-)

    Best regards
    Morten

  4. #4
    Registered User
    Join Date
    10-30-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007 Pro
    Posts
    27

    Re: Check status for url and validate redirects

    Hi Morten,
    Just for your information - when I was working it out I found that there can be several levels or redirect (sometimes up to six) so you might get a redirect from the second URL as well as the first.

    Check out this tool: http://redirectdetective.com/ with the URL www.microsoft.co.uk

    If it's a concern for you, you could try using that tool and scraping results from it for each URL. By the way - I have no connection to the website, it's just the first one I tried.
    Last edited by jeremyfox36; 11-26-2014 at 05:24 AM.

  5. #5
    Registered User
    Join Date
    08-13-2009
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    20

    Re: Check status for url and validate redirects

    Quote Originally Posted by jeremyfox36 View Post
    Hi Morten,
    Just for your information - when I was working it out I found that there can be several levels or redirect (sometimes up to six) so you might get a redirect from the second URL as well as the first.
    Thanks, I know that. But it's okay to only see the status code of the last URL in the link chain.

    Quote Originally Posted by jeremyfox36 View Post
    Check out this tool: http://redirectdetective.com/ with the URL www.microsoft.co.uk
    Great tool! I have been searching for such a tool to trace a URL.

  6. #6
    Registered User
    Join Date
    08-13-2009
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    20

    Re: Check status for url and validate redirects

    I'm not getting a good result on these url's. There is a difference between the result in Excel and the url tracer tool you mentioned.

    Result from Excel:

    http://shop.mediqdanmark.dk/katalog/...2/2353/4620001 | 301 - Moved Permanently | http redirect request failed | http redirect request failed
    http://shop.mediqdanmark.dk/katalog/...5/3516/4622004 | 301 - Moved Permanently | http redirect request failed | http redirect request failed
    http://shop.mediqdanmark.dk/katalog/...5/3519/4611040 | 301 - Moved Permanently | http redirect request failed | http redirect request failed

    Result from online url tracer:

    When I check the url with this tool "http://redirectdetective.com/" I'm getting this result: 301 permanent redirect => 301 permanent redirect => Final destination. It seems like the url is working, but in Excel I'm not getting the correct result.

    Do you know, what can be wrong? Is it the code? Is it because the final destination url contains special Danish characters like 'זרו'?

    Best regards
    Morten

  7. #7
    Registered User
    Join Date
    10-30-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007 Pro
    Posts
    27

    Re: Check status for url and validate redirects

    Hi Morten,

    It's definitely the code (not because of the Danish characters) but I'm not sure why.

    I've found out why the redirect request failed - it's because the 3rd URL is incomplete in the header. I've modified the code to extract the domain and add it to the incomplete 3rd URL but it's not flexible (i.e. the domain always comes from the 3rd column).

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jeremyfox36; 12-02-2014 at 01:44 PM.

  8. #8
    Registered User
    Join Date
    08-13-2009
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    20

    Re: Check status for url and validate redirects

    I appreciate your help - thanks a lot :-)
    I will check out your modified code and see if it solves the problem.

    Best regards
    Morten

  9. #9
    Registered User
    Join Date
    10-30-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007 Pro
    Posts
    27

    Re: Check status for url and validate redirects

    I'm just curious - what are you using it for? PM me if you like.

  10. #10
    Registered User
    Join Date
    08-13-2009
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    20

    Re: Check status for url and validate redirects

    It's okay. In our catalog our suppliers have the opportunity to give us an url for which leads to their own product website. We want to check the url or redirect, so our customers not click on an url and get a 404 or another error code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Textbox loop check to validate entry
    By D_N_L in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-29-2014, 10:49 AM
  2. Using VBA to find HTTP redirects
    By AKK9 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-01-2012, 05:05 PM
  3. Replies: 4
    Last Post: 04-08-2012, 09:43 PM
  4. need to find a way to validate and double check my data
    By semidevil in forum Excel General
    Replies: 4
    Last Post: 10-30-2010, 12:19 PM
  5. Check (validate) repeating sequence
    By imimin in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-27-2010, 05:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1