Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Dan-Thomas Tveita
Dan-Thomas Tveita
107 Points

wp: search.php subpage (page 2+) not working

Im having a problem with the pagination on my search page (search.php, working from _underscores theme). When searching for a keyword, im correctly taken to domain.com/?s=keyword. But when navigating to the second subpage, i end up on the frontpage, but the url is showing domain.com/page/2/?s=keyword

Im not really sure where to begin troubleshooting this. This is happening on my live page, but not on the local dev version. Same plugins, same template. Tried disabling plugins to no avail.

Any help appreciated!

cheers, dan

2 Answers

Jason Brady
Jason Brady
17,372 Points

First and fastest thing to check is a quick rebuild of your htaccess... Go into your admin panel>Settings>Permalinks, then just click 'Save Changes'.

If that doesn't fix it, the next step I would take in troubleshooting is to disable the theme... Go with 2015 as your theme, and check the url structure. My site's URLs look like this:

www.somesitename.com/?s=irrigation&paged=2

From what you find, it may be as easy as creating a quick rewrite function that structures the URL correctly in your theme.

Dan-Thomas Tveita
Dan-Thomas Tveita
107 Points

Hi, thanks for a quick response!

'Save changes' on permalinks didn't help, but i did a rewrite of the URL structure and it worked! So im good for now, thanks for pointing me in that direction!

Problem is though, that i still dont know what caused the problem...im no wiser. But the problem is solved!

dan