JoshoB Posted August 24, 2014 Share Posted August 24, 2014 I am rebuilding a website. Templates include a field "url_old" with a href to the page's URL on the old website. By surfing to the /redirect, the system should generate a list that can be copied and pasted into a .htaccess file. In order to find all of the pages that need to be redirected, I use the following in the template "redirect" (used by a single page located at home/redirect/): $results = $pages->find("url_old!=''"); To the best of my knowledge, $results should contain ALL pages with a field "url_old" that isn't empty. However, when the data is generated, it includes only the home page and all of the home page's children that have children of their own. Let me illustrate with an example: Home |- Page 1 |- Page 2 | |- Page A | |- Page B |- Page 3 |- Page 4 Let's assume that all of these pages have the "url_old" field filled in. You would expect the system to generate a list of ALL of these pages. Instead, it only lists "Home", "Page 2", "Page A", and "Page B". Somehow, it skips "Page 1" and the others. (When I do a count() of $results, it also lists just the pages that are shown, so 4 in this example, instead of 7.) I get the idea that I'm missing something obvious, but I can't see what. Anyone care to help? Link to comment Share on other sites More sharing options...
JoshoB Posted August 24, 2014 Author Share Posted August 24, 2014 Suddenly had a bright idea. The missing pages were set to "hidden". I needed to use: $results = $pages->find("url_old!='',include=hidden"); I'm leaving this page as a monument to my own stupidity. 2 Link to comment Share on other sites More sharing options...
diogo Posted August 24, 2014 Share Posted August 24, 2014 We all have days like this 1 Link to comment Share on other sites More sharing options...
adrian Posted August 24, 2014 Share Posted August 24, 2014 By surfing to the /redirect, the system should generate a list that can be copied and pasted into a .htaccess file. In order to find all of the pages that need to be redirected You could also have these links added as entries to the Redirects module (http://modules.processwire.com/modules/process-redirects/). 1 Link to comment Share on other sites More sharing options...
NooseLadder Posted August 25, 2014 Share Posted August 25, 2014 You could also have these links added as entries to the Redirects module (http://modules.processwire.com/modules/process-redirects/). I highly recommend this module. I have used it quite a bit and it makes redirecting a breeze 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now