Category and pages being added to links (5 posts)

  1. Barry Wells
    Posted 3 years ago #

    Hi all,

    Thanks in advance for any assistance people may offer.

    The problem:
    I have been entering links manually on my posts and pages, some for recommendations (products) and some to older posts of mine and other peoples. I always double check every link before publishing page or posts.

    I've just run a broken link checker and found 1,000's of links that have had category/page/category/category/ added to them, leaving me with 1,000's of broken links.

    Any ideas please?

    Regards, Barry

  2. phillbooth
    Posted 3 years ago #

    1) You should be able to use a "Find and replace" plugin to scan for a particular broken path. So /category/category/ can be changed to /category/

    2) Get a 404 page setup in your template.

  3. Barry Wells
    Posted 3 years ago #

    Hi Phill, thanks for your reply.

    There are loads of different variations of the links so I fear find and replace may be to long winded.... I'm currently working through old posts and removing dead links from them and the comments but I don't think that'll fix the issue mentioned above.

    Can you point me towards a guide for setting up a 404 page please?


  4. phillbooth
    Posted 3 years ago #

    Basically you make a 404.php in your top level of your template.


    What you put in there is ip to you however...
    If your good with PHP you could use the explode function to take the URL and break it down to its key words and then search your WP site for those key words.

    Try something like this if 404 then search WP

    Then explode using the / as a break
    $_SERVER['PHP_SELF'] returns path /category/page etc

    $keywords = explode("/",$myurl);
    foreach($keywords as $key){
    $searchstring=$searchstring.' '.$key;
    header("Location: http://www.example.com/?q=$searchstring");
  5. Barry Wells
    Posted 3 years ago #

    Thanks Phill, I'll look into sorting that out as soon as I've finished the spring clean :)


Topic Closed

This topic has been closed to new replies.

About this Topic