PagesRequest class

Methods for identifying and loading page from current request URL.

Methods in this class should be accessed from $pages->request(), i.e.

$page = $pages->request()->getPage();

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the PagesRequest class also inherits all the methods and properties of: Wire.

Show class?             Show args?        


PagesRequest::checkScheme(Page $page)
(nothing)If the template requires a different scheme/protocol than what is here, then redirect to it. 
Page NullPageGet closest matching page when getPage() returns an error/NullPage
stringGet the requested file 
stringGet request language name 
string Page nullGet login Page object or URL to redirect to for login needed to access given $page
Page NullPageGet the requested page
PagesRequest::getPageForUser(Page $page, User $user)
Page NullPageUpdate/get page for given user
null intGet the requested pagination number 
null stringGet the requested pagination number prefix 
intGet the redirect type (0, 301, 302, 307, 308) 
stringGet the redirect URL 
stringGet the requested file (alias of getFile method) 
NullPage PageGet page that was requested 
stringGet request path 
intGet response http code for this request 
stringGet response type name for this request 
arrayGet all possible response code names indexed by http response code 
stringGet message about response only if response was an error, blank otherwise 
stringGet message string about response 
Page NullPage nullSet current request page 
PagesRequest::setRedirectPath(string $redirectPath)
(nothing)Set the redirect path 
PagesRequest::setRedirectUrl(string $redirectUrl)
(nothing)Set the redirect URL 
PagesRequest::setRequestPath(string $requestPath)
(nothing)Set request path 
PagesRequest::setResponseMessage(string $message)
(nothing)Set response message 

Additional methods and properties

In addition to the methods and properties above, PagesRequest also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.200

Twitter updates

  • Weekly update: Smooth rollout for ProcessWire 3.0.200 main/master, plus getting started on a new WP-to-PW site conversion and why they can be so rewarding— More
    20 May 2022
  • New main/master version of ProcessWire that has more than 220 commits, resolves more than 80 issues, adds numerous new features, performance improvements and optimizations, and consumes HALF the disk space of our previous release— More
    13 May 2022
  • Summary of weekly core updates for 22 April 2022 More
    22 April 2022

Latest news

  • ProcessWire Weekly #419
    In issue 419 of ProcessWire Weekly we'll check out this week's core updates, introduce a brand new recipe of the week, and more. Read on! / 21 May 2022
  • ProcessWire 3.0.200 new master/main version
    This new main/master version has more than 220 commits, resolves more than 80 issues, adds numerous new features, performance improvements and optimizations, and consumes HALF the disk space of our previous release. This post covers all the details.
    Blog / 13 May 2022
  • Subscribe to weekly ProcessWire news

“ProcessWire is like a breath of fresh air. So powerful yet simple to build with and customise, and web editors love it too.” —Margaret Chatwin, Web developer