Leah Posted December 10, 2013 Share Posted December 10, 2013 Hi folks, you could help me with a PHP question. I changed our pagination from .../?page=0%2C0%2C1 to ?page=1. The problem now is that a few custom codes aren't working anymore. There is one code that puts all following pages as nofollow/noindex. The code worked with the long pagination URL but not with the short. Here's the code: <?php $target_page= explode("/",$_SERVER['REQUEST_URI']); $target_page= $target_page[1]; $pages_with_nofollow = array( 'nyc-apartments-by-school', 'park', ); if(in_array($target_page, $pages_with_nofollow) ===true){ $target_page_num = isset($_GET['page']) ? explode(",",$_GET['page']) : 0; $target_page_num = !empty($target_page_num) ? $target_page_num[2] : 0; if($target_page_num > 0){ $variables['head'] .= '<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">'; } } ?> What do I need to change? Thank you!!! Quote Link to comment Share on other sites More sharing options...
Solution dalecosp Posted December 10, 2013 Solution Share Posted December 10, 2013 For a quick hack, try changing this: $target_page_num = !empty($target_page_num) ? $target_page_num[2] : 0; to this: $target_page_num = !empty($target_page_num) ? $target_page_num[0] : 0; Not sure it's right, though --- YMMV and all that. Quote Link to comment Share on other sites More sharing options...
Leah Posted December 10, 2013 Author Share Posted December 10, 2013 You're a genius!!!! Thank you, it worked. Quote Link to comment Share on other sites More sharing options...
dalecosp Posted December 10, 2013 Share Posted December 10, 2013 You're a genius!!!! Thank you, it worked. LOL ... no, not *quite*. Just a programmer. Glad to hear it! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.