1

I have a column containing the html for page_content.

With my limited knowledge on SQL I can only find external links or links that have rel="nofollow" in them.

But I need help to find the links which are external and doesn't have the rel="nofollow" attribute and possible add it.

Lorem ipsum <a href="http://own-domain.com">dolor</a> sit amet, consectetur adipiscing elit.     
Cras mi lacus, <a href="http://external-domain.com">**mattis**</a> vel rutrum lobortis, pharetra in elit. Praesent consequat <a rel="nofollow" href="http://own-domain.com">condimentum</a> diam ut sodales.

I want to add nofollow attribute to mattis , taking care not to add it to own-domain or adding nofollow twice on condimentum.

UPDATE : Note, that I need to do this on the database of a custom CMS like wordpress. My pages are rendered in PHP. I can modify the source while content load. But I prefer to do this in the database layer to make it permanent.

4

1 回答 1

0

正如@hungerstar 建议的那样,这最好在mysql 之外完成。这可以在内容的生产者或消费者中。如果这是一项临时工作,您也许可以在读取行、更新它们并将它们插入回的辅助脚本中执行此操作

于 2013-08-02T06:06:39.560 回答