1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice

Getting the URLs from htaccess rewriterule

Discussion in 'White Hat SEO' started by illuminateme, May 7, 2018.

  1. illuminateme

    illuminateme Jr. VIP Jr. VIP

    Joined:
    Feb 24, 2016
    Messages:
    570
    Likes Received:
    269
    Occupation:
    human meat bag
    Location:
    the universe
    Have anyone else had to work with an old massive redirect list that's thousands of lines long?

    Is there a tool/reliable way to grab the origin url and destination url from a bunch of rewriterule from htaccess and dump it into a spreadsheet?

    or better yet, a tool that can identify and eliminate duplicates and compress the redirect chains?

    thank you in advance!
     
  2. Warrenway

    Warrenway Jr. VIP Jr. VIP

    Joined:
    Jan 28, 2017
    Messages:
    237
    Likes Received:
    91
    Gender:
    Male
    I don't know about an existing tool, but it wouldn't be too difficult to write a script to handle this.
     
  3. mlaurin

    mlaurin Newbie

    Joined:
    Aug 25, 2012
    Messages:
    11
    Likes Received:
    3
    Occupation:
    Web Marketing Analyst
    You should just be able to copy and paste all the URLs into a spreadsheet and have all the URLs end up in unique cells. You could then use a formula in excel to separate the URLs (assuming they didn't automatically go into their own cells when you paste them in the spreadsheet). I haven't worked with a .htaccess file much larger than several hundred lines but a combination of using spreadsheet features as well as search and replace features in notepad++ should be relatively painless (and has worked well for me ).

    Also, this post outlines how to manage data like you're talking about using a combination of Screaming Frog and Excel (there are some formulas in there as well you could try).

    salt[dot]agency/blog/how-to-deal-with-huge-amounts-of-redirects-in-a-seo-migration/

    And not sure if this rewrite generator would be useful.

    donatstudios[dot]com/RewriteRule_Generator

    Hope that helps.
     
  4. illuminateme

    illuminateme Jr. VIP Jr. VIP

    Joined:
    Feb 24, 2016
    Messages:
    570
    Likes Received:
    269
    Occupation:
    human meat bag
    Location:
    the universe
    That's basically the exact opposite of the problem I'm facing. I don't need help generating a list. I already have the list of 301s that was built manually over the years by multiple people, encased in htaccess rewriterule's, now i need to strip them of their regex syntax and oddities and manage them in a spreadsheet.