WordPress redirect

My friend Francesco (www.flussiliberi.it) was hosted on a free service without having a domain ,so, after buying a domain name and space, ask me a way to redirect all vistors that point direct to a post or page in the old WordPress blog to the corresponding page on new site.

I don't know if exist a plugin, but with a few php lines it's possible:

  1.  
  2. <?php
  3. $url="http://www.hacksandmore.com";
  4. if (($_GET["p"] === null) and ($_GET["page_id"] === null) and ($_GET["feed"]=== null) and ($_GET["cat"]=== null)) {
  5. $url=$url;
  6. }
  7. else
  8. {
  9. if(isset($_GET["cat"])) $url=$url."/?cat=".$_GET["cat"];
  10. if(isset($_GET["feed"])) $url=$url."/?feed=".$_GET["feed"];
  11. if(isset($_GET["p"])) $url=$url."/?p=".$_GET["p"];
  12. if(isset($_GET["page_id"])) $url=$url."/?page_id=".$_GET["page_id"];
  13. }
  14. <fieldset>
  15. <h1>Site transferred,
  16. redirect in a few seconds...</h1>
  17. <h3>WP redirect by: Umberto Bernardi
  18. <a href="http://www.hacksandmore.com">www.hacksandmore.com</a></h3>
  19. </fieldset>
  20. <script type="text/javascript"><!--mce:0--></script>
  21. ";
  22. ?>
  23.  

You can download the script in the right panel in Downloads section

This post is also available in: Italian

Comments (0)

› No comments yet.

Leave a Reply


*