Results 1 to 5 of 5
  1. #1
    PROFRBcom's Avatar
    PROFRBcom is offline Private Member
    Join Date
    April 2013
    Posts
    2,173
    Thanks
    1,511
    Thanked 1,243 Times in 808 Posts

    Default Drupal 7 Site - Hardcode Links - Want to Swap to Relative - Seeking Advice

    I've recently swapped one of our sites to new hosting and upgraded to https. 301'd everything and all of that is working well, SE are starting to index the https pages, etc. However, I have a lingering issue I'd like to address.

    Before this swap, for the entire life of this particular site, all the links were hard-coded into the site as "http://example.com/content-goes-here". I'd like to change every link on the site to relative linking and thus drop the http://example.com part, leaving only "/content-goes-here" behind.

    As it stands, the only way I currently know how to do this is to open every page, copy, paste, find+replace, copy, paste, save. Rinse and repeat for 1k+ pages. That seems like a nightmare and a waste of time. I was hoping there was a faster way. Someone who uses a WP site told me they were able to "open their database in Dreamweaver, find+replace, and were done in 15 seconds". I'd love to find a similar solution for my Drupal 7 site, but I can't seem to find a solution online.

    I was very much hoping someone here with Drupal experience could point me in the right direction so that I'm not stuck editing 1k+ pages by hand...
    https://professionalrakeback.com

    We write excellent long-form content for other webmasters, for free.
    How can we work together on a win/win deal? Be creative!

  2. #2
    universal4's Avatar
    universal4 is offline Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    34,042
    Thanks
    4,565
    Thanked 9,313 Times in 5,994 Posts

    Default

    I am not a drupal or sql pro, but you could likely export the appropriate tables to a dump file, find and replace and then import back in.

    I too would be a bit nervous to do it, but you could export the entire thing, do the search and replace, then import back into a database with a new name and change the config file to look at the new database, and test everything, if it does not work as planned change the config back to the old database and you would be back to where you started.

    Maybe someone here can help more.

    Rick
    Universal4

  3. The Following User Says Thank You to universal4 For This Useful Post:

    PROFRBcom (11 October 2017)

  4. #3
    Muppet is offline Private Member
    Join Date
    December 2007
    Posts
    577
    Thanks
    166
    Thanked 661 Times in 290 Posts

    Default

    Its a simple search and replace in the database. Here's someone asking the same thing on Stack Exchange.
    https://drupal.stackexchange.com/que...-automatically

    Don't forget to backup everything first and empty your cache after doing the replace.

  5. The Following User Says Thank You to Muppet For This Useful Post:

    PROFRBcom (11 October 2017)

  6. #4
    PROFRBcom's Avatar
    PROFRBcom is offline Private Member
    Join Date
    April 2013
    Posts
    2,173
    Thanks
    1,511
    Thanked 1,243 Times in 808 Posts

    Default

    Quote Originally Posted by Muppet View Post
    Its a simple search and replace in the database. Here's someone asking the same thing on Stack Exchange.
    https://drupal.stackexchange.com/que...-automatically

    Don't forget to backup everything first and empty your cache after doing the replace.
    Heh, never as simple with me it seems... we have no shell access in our new hosting environment:

    Does Pantheon have FTP or shell access?

    Pantheon supports toggling between local development mode using git push to transfer all code changes, and an on-server development mode, which provides access to the codebase via SFTP.
    Direct SSH access is not supported, but you are able to directly interface with mysql, use CLI tools (Terminus, drush, WP-CLI, and SFTP files.

    Also, thanks for that link!

  7. #5
    Muppet is offline Private Member
    Join Date
    December 2007
    Posts
    577
    Thanks
    166
    Thanked 661 Times in 290 Posts

    Default

    "Direct SSH access is not supported, but you are able to directly interface with mysql" - that is all you need.

  8. The Following User Says Thank You to Muppet For This Useful Post:

    PROFRBcom (12 October 2017)

Posting Permissions

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