4

Hi i am new to the drupal and i got problem in my site in the hyperlinks. I have book copy module by which i have created one copy of the book. After creating the book i set aliases to content/newbook but the links in the content pointing to the old links they have not updated so i need some module which can change all hyperlinks in the content. I have tried with views/pathauto/pathlogic/path filter but not able to solve the problem any of these. Please let me know if there any such module.

2 Answers 2

0

That is a good reason why you shouldn't link to path aliases in your text areas. Because if they change you are in a mess.

You should always link to non-aliased patch like node/12 or user/4.

Then you can use a module to make your node/12 type links pretty. Namely the pathologic module will do that.

Do you have any record of what the old path aliases were or are they gone from the system and only the new aliases remain?

If the old ones are gone then you are out of luck, there is no way of knowing what pages those links should link to.

If the old ones are still there, you will be able to do some custom PHP/SQL to fix the issue.

You will have to check all the field values (database tables starting with field_data_ and field_revision_) for links, then check the url_alias table for 'alias' matching the link. If there is one get the 'source'. Then you re-write the link in the field value to use the source path and write it back to the database.

That should allow you to get your links to be of the form node/12, which is good.

Then to get pretty urls in text set up the pathologic module.

2
  • Note that the module Gisle Hannemyr mentions in his answer would make it easier for you to re-write the links to what they should be. However it still stands that unless you have a record of what the aliases used to be I can't see a way to do it.
    – rooby
    Apr 25, 2013 at 12:14
  • Ok. Thanks for your Suggestions.I am trying to do with that. Apr 29, 2013 at 10:57
2

I am not sure if I understand the problem correctly.

But if you're looking for a module that will do a batch search and replace, replacing the path of an URL embedded in node content with another path, the search and replace scanner can do plain text search-and-replace, or regular expression search-and-replace, against the body fields on all nodes in your system.

2
  • Nice module, I hadn't seen that one before.
    – rooby
    Apr 25, 2013 at 12:12
  • Full credit to you dude. its working fine and what i want to achieve is i got i am very much happy as i have done it. Special thanks to Gisle Hannemyr. Apr 29, 2013 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.